diff options
Diffstat (limited to 'helgrind/tests/.svn/text-base/hg01_all_ok.c.svn-base')
-rw-r--r-- | helgrind/tests/.svn/text-base/hg01_all_ok.c.svn-base | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/helgrind/tests/.svn/text-base/hg01_all_ok.c.svn-base b/helgrind/tests/.svn/text-base/hg01_all_ok.c.svn-base new file mode 100644 index 0000000..144ce60 --- /dev/null +++ b/helgrind/tests/.svn/text-base/hg01_all_ok.c.svn-base @@ -0,0 +1,32 @@ +/* All OK */ + +#include <pthread.h> + +static pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER; + +static int shared; + +static void *th(void *v) +{ + pthread_mutex_lock(&mx); + shared++; + pthread_mutex_unlock(&mx); + + return 0; +} + +int main() +{ + pthread_t a, b; + + pthread_mutex_lock(&mx); + pthread_mutex_unlock(&mx); + + pthread_create(&a, NULL, th, NULL); + pthread_create(&b, NULL, th, NULL); + + pthread_join(a, NULL); + pthread_join(b, NULL); + + return 0; +} |