If you can do this, your threaded code will be really efficient and it won't tie up valuable mutex locks.
如果能够做到这一点,线程代码将是非常高效的,并且不会占用宝贵的互斥对象锁。
Clearly, pushing data into the queue is akin to appending data to the list, and this operation must be guarded by mutex locks.
显然,把数据放到队列中就像是把数据添加到列表中,必须使用互斥锁保护这个操作。
While blocked, the managed task continues to hold any Shared resources it acquired during the course of its dispatch (for example, storage resources, task-level resources, and mutex locks).
在阻塞的情况下,托管任务将继续持有其在调度期间获得的所有共享资源(例如,存储资源、任务级别的资源和互斥锁定)。
This routine does something new; it locks a mutex called, creatively enough, count_mutex.
这个例程做了一些新的工作;它锁定一个叫做count _ mutex的互斥量。
The first thread locks the mutex and appends data to the queue, while the other threads wait for their turn.
第一个线程锁住互斥并把数据添加到队列中,而其他线程等待轮到它们操作。
If another thread locks the mutex, the pthread_mutex_trylock will not block.
如果另一个线程锁定了那个互斥,则pthread _ mutex _ trylock将不会阻塞。
The middleware locks a mutex at the beginning of the request, and unlocks the mutex when the request finishes.
这个中间件在请求开始之前加一个互斥锁,在请求结束之后解开这个锁。
Multiple locks of this mutex shall require the same number of unlocks to release the mutex before another thread can acquire the mutex.
多次锁定互斥锁需要进行相同次数的解除锁定才可以释放该锁,然后其他线程才能获取该互斥锁。
Multiple locks of this mutex shall require the same number of unlocks to release the mutex before another thread can acquire the mutex.
多次锁定互斥锁需要进行相同次数的解除锁定才可以释放该锁,然后其他线程才能获取该互斥锁。
应用推荐