^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #include <liblockdep/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #include "common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) void main(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) pthread_mutex_t a, b, c, d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) pthread_mutex_init(&a, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) pthread_mutex_init(&b, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) pthread_mutex_init(&c, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) pthread_mutex_init(&d, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) LOCK_UNLOCK_2(a, b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) LOCK_UNLOCK_2(c, d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) LOCK_UNLOCK_2(b, c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) LOCK_UNLOCK_2(d, a);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) pthread_mutex_destroy(&d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) pthread_mutex_destroy(&c);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) pthread_mutex_destroy(&b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) pthread_mutex_destroy(&a);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) }