• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/apr-30/apr/apr/locks/win32/

Lines Matching refs:rwlock

26     apr_thread_rwlock_t *rwlock = data;
28 if (! CloseHandle(rwlock->read_event))
31 if (! CloseHandle(rwlock->write_mutex))
37 APR_DECLARE(apr_status_t)apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock,
40 *rwlock = apr_palloc(pool, sizeof(**rwlock));
42 (*rwlock)->pool = pool;
43 (*rwlock)->readers = 0;
45 if (! ((*rwlock)->read_event = CreateEvent(NULL, TRUE, FALSE, NULL))) {
46 *rwlock = NULL;
50 if (! ((*rwlock)->write_mutex = CreateMutex(NULL, FALSE, NULL))) {
51 CloseHandle((*rwlock)->read_event);
52 *rwlock = NULL;
56 apr_pool_cleanup_register(pool, *rwlock, thread_rwlock_cleanup,
62 static apr_status_t apr_thread_rwlock_rdlock_core(apr_thread_rwlock_t *rwlock,
65 DWORD code = WaitForSingleObject(rwlock->write_mutex, milliseconds);
74 InterlockedIncrement(&rwlock->readers);
76 if (! ResetEvent(rwlock->read_event))
79 if (! ReleaseMutex(rwlock->write_mutex))
85 APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock)
87 return apr_thread_rwlock_rdlock_core(rwlock, INFINITE);
91 apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock)
93 return apr_thread_rwlock_rdlock_core(rwlock, 0);
97 apr_thread_rwlock_wrlock_core(apr_thread_rwlock_t *rwlock, DWORD milliseconds)
99 DWORD code = WaitForSingleObject(rwlock->write_mutex, milliseconds);
107 if (rwlock->readers) {
112 ? WaitForSingleObject(rwlock->read_event, milliseconds)
117 if (! ReleaseMutex(rwlock->write_mutex))
127 APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock)
129 return apr_thread_rwlock_wrlock_core(rwlock, INFINITE);
132 APR_DECLARE(apr_status_t)apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock)
134 return apr_thread_rwlock_wrlock_core(rwlock, 0);
137 APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock)
142 if (! ReleaseMutex(rwlock->write_mutex))
147 if (rwlock->readers &&
148 ! InterlockedDecrement(&rwlock->readers) &&
149 ! SetEvent(rwlock->read_event)) {
160 APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock)
162 return apr_pool_cleanup_run(rwlock->pool, rwlock, thread_rwlock_cleanup);