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
);
59 puts ("pthread_mutex_init");
63 for (i
= 0; i
< sizeof (t
) / sizeof (t
[0]); i
++)
65 err
= pthread_create (&t
[i
], NULL
, tf
, (void *) (long int) i
);
68 puts ("pthread_create");
73 for (i
= 0; i
< sizeof (t
) / sizeof (t
[0]); i
++)
75 err
= pthread_join (t
[i
], NULL
);
78 puts ("pthread_join");
86 #define TEST_FUNCTION do_test ()
87 #include "../test-skeleton.c"