9 static pthread_mutex_t m
;
14 int err
= pthread_mutex_lock (&m
);
15 if (err
== EOWNERDEAD
)
17 err
= pthread_mutex_consistent_np (&m
);
20 puts ("pthread_mutex_consistent_np");
26 puts ("pthread_mutex_lock");
29 printf ("thread%ld got the lock.\n", (long int) data
);
31 /* exit without unlock */
40 pthread_mutexattr_t ma
;
42 pthread_mutexattr_init (&ma
);
43 err
= pthread_mutexattr_setrobust_np (&ma
, PTHREAD_MUTEX_ROBUST_NP
);
46 puts ("pthread_mutexattr_setrobust_np");
50 if (pthread_mutexattr_setprotocol (&ma
, PTHREAD_PRIO_INHERIT
) != 0)
52 puts ("pthread_mutexattr_setprotocol failed");
56 err
= pthread_mutex_init (&m
, &ma
);
60 puts ("PI robust mutexes not supported");
66 puts ("pthread_mutex_init");
70 for (i
= 0; i
< sizeof (t
) / sizeof (t
[0]); i
++)
72 err
= pthread_create (&t
[i
], NULL
, tf
, (void *) (long int) i
);
75 puts ("pthread_create");
80 for (i
= 0; i
< sizeof (t
) / sizeof (t
[0]); i
++)
82 err
= pthread_join (t
[i
], NULL
);
85 puts ("pthread_join");
93 #define TEST_FUNCTION do_test ()
94 #include "../test-skeleton.c"