diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2018-05-21 20:08:22 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-07-31 12:21:50 +0100 |
commit | 596a82f2d185b101bd74645492821fe2f9e0daa0 (patch) | |
tree | 3a595c888df37054bebb989455e73ea3683c6477 /meson-cc-tests/pthread.c | |
parent | a75f8df95761bf88b54c326c5312117ea5073010 (diff) | |
download | cairo-596a82f2d185b101bd74645492821fe2f9e0daa0.tar.gz |
Add meson build definitions
Co-Authored by:
Nirbheek Chauhan <nirbheek@centricular.com>
lb90 <luca.bacci982@gmail.com>
Tim-Philipp Müller <tim@centricular.com>
Diffstat (limited to 'meson-cc-tests/pthread.c')
-rw-r--r-- | meson-cc-tests/pthread.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/meson-cc-tests/pthread.c b/meson-cc-tests/pthread.c new file mode 100644 index 000000000..035cb3a94 --- /dev/null +++ b/meson-cc-tests/pthread.c @@ -0,0 +1,35 @@ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* for PTHREAD_MUTEX_INITIALIZER under linux */ +#endif +#include <pthread.h> + +pthread_mutex_t test_mutex_initializer = PTHREAD_MUTEX_INITIALIZER; +int test_mutex (void) +{ + int x = 0; + pthread_mutex_t mutex; + x |= pthread_mutex_init (&mutex, NULL); + x |= pthread_mutex_lock (&mutex); + x |= pthread_mutex_unlock (&mutex); + x |= pthread_mutex_destroy (&mutex); + return 0; +} + +int test_mutex_attr (void) +{ + int x = 0; + pthread_mutexattr_t attr; + pthread_mutex_t mutex; + x |= pthread_mutexattr_init (&attr); + x |= pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); + x |= pthread_mutex_init (&mutex, &attr); + x |= pthread_mutex_lock (&mutex); + x |= pthread_mutex_unlock (&mutex); + x |= pthread_mutex_destroy (&mutex); + x |= pthread_mutexattr_destroy (&attr); + return x; +} + +int main(void) { + return 0; +} |