mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-06 17:21:22 +00:00
dm: safely use pthread_cond_broadcast()
Use pthread_cond_broadcast() while holding the mutex to guarantee the signaling of its condition variable. Tracked-On: #2763 Signed-off-by: Peter Fang <peter.fang@intel.com> Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
@@ -925,8 +925,9 @@ blockif_close(struct blockif_ctxt *bc)
|
||||
*/
|
||||
pthread_mutex_lock(&bc->mtx);
|
||||
bc->closing = 1;
|
||||
pthread_mutex_unlock(&bc->mtx);
|
||||
pthread_cond_broadcast(&bc->cond);
|
||||
pthread_mutex_unlock(&bc->mtx);
|
||||
|
||||
for (i = 0; i < BLOCKIF_NUMTHR; i++)
|
||||
pthread_join(bc->btid[i], &jval);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user