WEAK_SCOPED_MUTEX_LOCK/WEAK_MUTEX_TRY_LOCK revisited
- Dominant language
- C++
- Stars
- 2k
- Forks
- 874
- Avg merge
- 6d 15h
- Merged PRs (30d)
- 46
Description
`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.
Contributor guide
Assessment
This issue has not been assessed yet.