drd/tests/swapcontext: Improve the portability of this test further
[valgrind.git] / drd / tests / pth_process_shared_mutex.c
blob1344761f44e33d08f2c26a62a5204da9002fb84f
1 /*
2 * Test program that locks and unlocks a process-shared mutex.
3 * See also https://bugs.kde.org/show_bug.cgi?id=187048.
4 */
7 #define _GNU_SOURCE
9 #include <stdio.h>
10 #include <pthread.h>
13 int main()
15 pthread_mutex_t mutex;
16 pthread_mutexattr_t attr;
18 pthread_mutexattr_init(&attr);
19 pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
20 pthread_mutex_init(&mutex, &attr);
21 pthread_mutexattr_destroy(&attr);
23 pthread_mutex_lock(&mutex);
24 pthread_mutex_unlock(&mutex);
25 pthread_mutex_destroy(&mutex);
27 fprintf(stderr, "Finished.\n");
29 return 0;