多线程重新锁定互斥量
Multiple threads re-locking mutex
我想知道当互斥量解锁时会发生什么,并且等待同一个互斥量的两个不同线程收到确认?是否有一些类似命令的队列将互斥量分配给首先请求它的线程,或者选择是随机的?
If there are threads blocked on the mutex object referenced by mutex when pthread_mutex_unlock() is called, resulting in the mutex becoming available, the scheduling policy shall determine which thread shall acquire the mutex.
所以选择可以是随机的,可以是队列,可以是调度程序希望做的任何事情。
我想知道当互斥量解锁时会发生什么,并且等待同一个互斥量的两个不同线程收到确认?是否有一些类似命令的队列将互斥量分配给首先请求它的线程,或者选择是随机的?
If there are threads blocked on the mutex object referenced by mutex when pthread_mutex_unlock() is called, resulting in the mutex becoming available, the scheduling policy shall determine which thread shall acquire the mutex.
所以选择可以是随机的,可以是队列,可以是调度程序希望做的任何事情。