mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-25 02:41:45 +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:
@@ -295,9 +295,10 @@ virtio_net_tx_stop(struct virtio_net *net)
|
||||
{
|
||||
void *jval;
|
||||
|
||||
pthread_mutex_lock(&net->tx_mtx);
|
||||
net->closing = 1;
|
||||
|
||||
pthread_cond_broadcast(&net->tx_cond);
|
||||
pthread_mutex_unlock(&net->tx_mtx);
|
||||
|
||||
pthread_join(net->tx_tid, &jval);
|
||||
}
|
||||
|
Reference in New Issue
Block a user