Search code examples
multithreadinggoconcurrencymutex

How to find the number of threads waiting for mutex lock in Sync.Mutex?


I am using this in a go subroutine

    a.Lock()
    ...
    enter code here
    ...
    a.Unlock()

Is there any api to know how many threads are waiting at a.Lock()?


Solution

  • Is there any api to know how many threads are waiting at a.Lock()?

    No.

    (And basically if you need to know that you should redesign your aglorithm.)