On 4/21/13 10:47 PM, Yunkai Zhang wrote: > MUTEX_TRY_LOCK_FOR() will check whether the mutex->thread_holding equal to > this_thread() when in debug mode. > > So, I think passing mutex->thread_holding will help us to do some check for > the code.
I also think that the code predates a lot of improvements from the last 10+ years. And even if thread specific is relatively cheap today, it might not be true on all platforms (e.g. 32-bit) or hardware. That's a guess at least. It'd be interesting to benchmark this and see if it makes a difference using the two methods of getting the thread. Cheers, -- leif