gpt4 book ai didi

c - 在 linux 内核中持有互斥量时 sleep

转载 作者:行者123 更新时间:2023-12-04 11:14:15 24 4
gpt4 key购买 nike

如果一个进程在持有互斥量时休眠会发生什么?例如,如果我有以下代码:

mutex_lock(mtx);
wait_event_unterruptible_timeout(wait_queue_head, condition, timeout);
//some other code
mutex_unlock(mtx);

互斥体是否在休眠时释放并在进程唤醒前重新获取?还是进程在休眠时保持互斥量?

谢谢

最佳答案

互斥锁被持有。

它说明了它在 jar 头上的作用。

关于c - 在 linux 内核中持有互斥量时 sleep ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17007249/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com