tracing-mutex icon indicating copy to clipboard operation
tracing-mutex copied to clipboard

Support `parking_lot::Condvar`

Open bertptrs opened this issue 3 years ago • 0 comments

It would be nice if this crate could support parking_lot::Condvar similar to std::sync::Condvar is supported. Unfortunately, the approach taken for std doesn't work.

For std, we unwrap the passed mutex guard and simply pass that to the wrapped Condvar. For parking lot this does not work for two reasons:

  1. The Condvar accepts the guard by mutable reference rather than by value. This prevents destructuring, but that turns out to not be a problem because
  2. It appears "impossible" to get a parking_lot::MutexGuard from a tracing_mutex::parkinglot::TracingMutexGuard. The added indirection of the lock_api primitives and private fields means we cannot just access that.

The word impossible is intentionally in quotes because I'm nowhere near sure that there's actually no way to do it.

bertptrs avatar May 17 '22 20:05 bertptrs