Changeset View
Changeset View
Standalone View
Standalone View
lib/libthr/thread/thr_rtld.c
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | _thr_rtld_lock_release(void *lock) | ||||
int32_t state; | int32_t state; | ||||
int errsave; | int errsave; | ||||
curthread = _get_curthread(); | curthread = _get_curthread(); | ||||
SAVE_ERRNO(); | SAVE_ERRNO(); | ||||
l = (struct rtld_lock *)lock; | l = (struct rtld_lock *)lock; | ||||
state = l->lock.rw_state; | state = l->lock.rw_state; | ||||
if (__predict_false(_thr_after_fork)) { | |||||
markj: Perhaps use `__predict_false` here. | |||||
/* | |||||
* After fork, only this thread is running, there is no | |||||
* waiters. Keeping waiters recorded in rwlock breaks | |||||
* wake logic. | |||||
*/ | |||||
atomic_clear_int(&l->lock.rw_state, | |||||
URWLOCK_WRITE_WAITERS | URWLOCK_READ_WAITERS); | |||||
l->lock.rw_blocked_readers = 0; | |||||
l->lock.rw_blocked_writers = 0; | |||||
} | |||||
if (_thr_rwlock_unlock(&l->lock) == 0) { | if (_thr_rwlock_unlock(&l->lock) == 0) { | ||||
if ((state & URWLOCK_WRITE_OWNER) == 0) | if ((state & URWLOCK_WRITE_OWNER) == 0) | ||||
curthread->rdlock_count--; | curthread->rdlock_count--; | ||||
THR_CRITICAL_LEAVE(curthread); | THR_CRITICAL_LEAVE(curthread); | ||||
} | } | ||||
RESTORE_ERRNO(); | RESTORE_ERRNO(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |
Perhaps use __predict_false here.