#include #include #include #include #include #include #include void *f(void *arg) { int r; toku_pthread_rwlock_t *mylock = arg; printf("%s:%d:%d\n", __FUNCTION__, __LINE__, toku_os_gettid()); fflush(stdout); r = toku_pthread_rwlock_wrlock(mylock); assert(r == 0); printf("%s:%d:%d\n", __FUNCTION__, __LINE__, toku_os_gettid()); fflush(stdout); r = toku_pthread_rwlock_wrunlock(mylock); assert(r == 0); printf("%s:%d:%d\n", __FUNCTION__, __LINE__, toku_os_gettid()); fflush(stdout); return arg; } int test_main(int argc, char *argv[]) { int r; toku_pthread_rwlock_t rwlock; const int nthreads = 2; toku_pthread_t tid[nthreads]; void *retptr; int i; r = toku_pthread_rwlock_init(&rwlock, NULL); assert(r == 0); printf("%s:%d:%d\n", __FUNCTION__, __LINE__, toku_os_gettid()); fflush(stdout); r = toku_pthread_rwlock_rdlock(&rwlock); assert(r == 0); for (i=0; i