无论在哪种情形中,当控制被返回时,调用者将持有互斥锁。
In either case, when control is returned, the caller holds the mutex.
操作系统调度程序决定哪个线程获得对互斥锁的控制权—通常,等待时间最长的读线程先读取数据。
The operating system scheduler determines which thread gets control of the mutex next-typically, the reader thread that has waited the longest gets to read the data first.
多个控制线程可以同时在队列中添加数据或删除数据,所以需要用互斥锁对象管理同步。
Multiple threads of control can simultaneously try to push data to the queue or remove data, so you need a mutex object to manage the synchronization.
应用推荐