mutex_islocked_np -> mutex_isowned_np
This commit is contained in:
parent
1cbdac2668
commit
ecd14de7d7
@ -1,6 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= mutex_islocked_np
|
||||
PROG= mutex_isowned_np
|
||||
NO_MAN=
|
||||
|
||||
LDADD= -lpthread
|
@ -37,8 +37,8 @@ thread(void *arg)
|
||||
{
|
||||
pthread_mutex_t *mtx = arg;
|
||||
|
||||
if (pthread_mutex_islocked_np(mtx) != 0) {
|
||||
printf("pthread_mutex_islocked_np() returned non-zero\n"
|
||||
if (pthread_mutex_isowned_np(mtx) != 0) {
|
||||
printf("pthread_mutex_isowned_np() returned non-zero\n"
|
||||
"for a mutex held by another thread\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -52,22 +52,22 @@ main(int argc, char *argv[])
|
||||
pthread_mutex_t mtx;
|
||||
|
||||
pthread_mutex_init(&mtx, NULL);
|
||||
if (pthread_mutex_islocked_np(&mtx) != 0) {
|
||||
printf("pthread_mutex_islocked_np() returned non-zero\n"
|
||||
if (pthread_mutex_isowned_np(&mtx) != 0) {
|
||||
printf("pthread_mutex_isowned_np() returned non-zero\n"
|
||||
"for a mutex that is not held\n");
|
||||
exit(1);
|
||||
}
|
||||
pthread_mutex_lock(&mtx);
|
||||
if (pthread_mutex_islocked_np(&mtx) == 0) {
|
||||
printf("pthread_mutex_islocked_np() returned zero\n"
|
||||
if (pthread_mutex_isowned_np(&mtx) == 0) {
|
||||
printf("pthread_mutex_isowned_np() returned zero\n"
|
||||
"for a mutex we hold ourselves\n");
|
||||
exit(1);
|
||||
}
|
||||
pthread_create(&thr, NULL, thread, &mtx);
|
||||
pthread_join(thr, NULL);
|
||||
pthread_mutex_unlock(&mtx);
|
||||
if (pthread_mutex_islocked_np(&mtx) != 0) {
|
||||
printf("pthread_mutex_islocked_np() returned non-zero\n"
|
||||
if (pthread_mutex_isowned_np(&mtx) != 0) {
|
||||
printf("pthread_mutex_isowned_np() returned non-zero\n"
|
||||
"for a mutex that is not held\n");
|
||||
exit(1);
|
||||
}
|
Loading…
Reference in New Issue
Block a user