Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/iocore/eventsystem/Lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@ Mutex_trylock(
if (m->thread_holding != t) {
if (!ink_mutex_try_acquire(&m->the_mutex)) {
#ifdef DEBUG
lock_waiting(m->srcloc, m->handler);
// Report the waiting site, not the holder's. m->srcloc and m->handler
// belong to whichever thread holds the mutex, and this thread just failed
// to acquire it, so reading them races with the holder publishing them
// below and clearing them in Mutex_unlock(). Any holder snapshot is stale
// the instant it is taken anyway; lock_holding() still reports the holder
// from Mutex_unlock(), where the fields are owned by the caller.
lock_waiting(location, ahandler);
#ifdef LOCK_CONTENTION_PROFILING
m->unsuccessful_nonblocking_acquires++;
m->nonblocking_acquires++;
Expand Down