trafficserver
trafficserver copied to clipboard
WEAK_SCOPED_MUTEX_LOCK/WEAK_MUTEX_TRY_LOCK revisited
WEAK_SCOPED_MUTEX_LOCK
and WEAK_MUTEX_TRY_LOCK
are introduced to allow the mutex to be a nullptr.
https://github.com/apache/trafficserver/blob/31c15927e66c30566edf5e0e83c6b1bf39e84288/include/iocore/eventsystem/Lock.h#L52-L57
Typical usage is below. https://github.com/apache/trafficserver/blob/31c15927e66c30566edf5e0e83c6b1bf39e84288/src/api/APIHook.cc#L73-L75
However, if we take a look at the Continuation::handleEvent
in this case, it has a release assert of the mutex.
https://github.com/apache/trafficserver/blob/31c15927e66c30566edf5e0e83c6b1bf39e84288/include/iocore/eventsystem/Continuation.h#L223-L229
It looks like we don't have reason to use WEAK_
version to allow nullptr in many cases.
Hmm, I need to think this through a bit. I'm referencing #5879 to keep track of related PRs.