Lines Matching defs:lock

50 /* Global function pointers to lock-related functions. NULL if locking isn't
62 * running a given event_base's loop. Requires lock. */
69 * thread. Requires lock. */
75 /** Allocate a new lock, and store it in lockvar, a void*. Sets lockvar to
81 /** Free a given lock, if it is present and locking is enabled. */
89 /** Acquire a lock. */
93 evthread_lock_fns_.lock(mode, lockvar); \
96 /** Release a lock */
113 /** Lock an event_base, if it is set up for locking. Acquires the lock
124 /** If lock debugging is enabled, and lock is non-null, assert that 'lock' is
126 #define EVLOCK_ASSERT_LOCKED(lock) \
128 if ((lock) && evthread_lock_debugging_enabled_) { \
129 EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
133 /** Try to grab the lock for 'lockvar' without blocking, and return 1 if we
135 static inline int EVLOCK_TRY_LOCK_(void *lock);
137 EVLOCK_TRY_LOCK_(void *lock)
139 if (lock && evthread_lock_fns_.lock) {
140 int r = evthread_lock_fns_.lock(EVTHREAD_TRY, lock);
144 * of course we count as having the lock. */
168 * holding 'lock'. The lock will be released until the condition is
171 #define EVTHREAD_COND_WAIT(cond, lock) \
172 ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), NULL) : 0 )
175 #define EVTHREAD_COND_WAIT_TIMED(cond, lock, tv) \
176 ( (cond) ? evthread_cond_fns_.wait_condition((cond), (lock), (tv)) : 0 )
180 (evthread_lock_fns_.lock != NULL)
187 void evthreadimpl_lock_free_(void *lock, unsigned locktype);
188 int evthreadimpl_lock_lock_(unsigned mode, void *lock);
189 int evthreadimpl_lock_unlock_(unsigned mode, void *lock);
193 int evthreadimpl_cond_wait_(void *cond, void *lock, const struct timeval *tv);
213 /** Acquire a lock. */
220 /** Release a lock */
227 /** Lock an event_base, if it is set up for locking. Acquires the lock
238 /** If lock debugging is enabled, and lock is non-null, assert that 'lock' is
240 #define EVLOCK_ASSERT_LOCKED(lock) \
242 if ((lock) && evthreadimpl_is_lock_debugging_enabled_()) { \
243 EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
247 /** Try to grab the lock for 'lockvar' without blocking, and return 1 if we
249 static inline int EVLOCK_TRY_LOCK_(void *lock);
251 EVLOCK_TRY_LOCK_(void *lock)
253 if (lock) {
254 int r = evthreadimpl_lock_lock_(EVTHREAD_TRY, lock);
258 * of course we count as having the lock. */
281 * holding 'lock'. The lock will be released until the condition is
284 #define EVTHREAD_COND_WAIT(cond, lock) \
285 ( (cond) ? evthreadimpl_cond_wait_((cond), (lock), NULL) : 0 )
288 #define EVTHREAD_COND_WAIT_TIMED(cond, lock, tv) \
289 ( (cond) ? evthreadimpl_cond_wait_((cond), (lock), (tv)) : 0 )
307 #define EVBASE_ACQUIRE_LOCK(base, lock) EVUTIL_NIL_STMT_
308 #define EVBASE_RELEASE_LOCK(base, lock) EVUTIL_NIL_STMT_
309 #define EVLOCK_ASSERT_LOCKED(lock) EVUTIL_NIL_STMT_
311 #define EVLOCK_TRY_LOCK_(lock) 1
317 #define EVTHREAD_COND_WAIT(cond, lock) EVUTIL_NIL_STMT_
318 #define EVTHREAD_COND_WAIT_TIMED(cond, lock, howlong) EVUTIL_NIL_STMT_
324 /* This code is shared between both lock impls */
358 int evthread_is_debug_lock_held_(void *lock);
359 void *evthread_debug_get_real_lock_(void *lock);