]>
git.saurik.com Git - apple/libpthread.git/blob - tests/rwlock-22244050.c
6 #include <libkern/OSAtomic.h>
13 void sighandler(int sig
)
16 OSSpinLockLock(&slock
);
17 OSSpinLockUnlock(&slock
);
20 fprintf(stderr
, "FAIL (%d)\n", i
);
25 void* thread(void *arg
)
27 pthread_rwlock_rdlock(&lock
);
28 pthread_rwlock_unlock(&lock
);
32 int main(int argc
, const char *argv
[])
34 pthread_rwlock_init(&lock
, NULL
);
35 signal(SIGUSR1
, sighandler
);
36 signal(SIGALRM
, sighandler
);
41 pthread_rwlock_wrlock(&lock
);
42 pthread_create(&thr
, NULL
, thread
, NULL
);
43 OSSpinLockLock(&slock
);
44 pthread_kill(thr
, SIGUSR1
);
45 pthread_rwlock_unlock(&lock
);
46 OSSpinLockUnlock(&slock
);
49 fprintf(stderr
, "PASS\n");