I am using boost 1.41.0. Is there a way to use boost to find how many people are waiting on the lock?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No: there is no way to get a reliable answer as it could change before the function returns, and Boost’s interface doesn’t provide an unreliable method either.
If you want such a thing, you’ll need to implement your own thread-safe counter alongside the mutex; off the top of my head I’m not sure that you could do that reliably either, but you could quite easily distinguish between “approximately none”, “a few” and “lots” if that’s good enough for your needs.