Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
sema_init 和 sem_init 有什么区别?各自的 API 是否有任何特定的使用场景和其他依赖项?
由于您用“linux”标记了它,我将忽略其他 Unix。
sema_init 是Linux内核的计数信号量实现初始化函数。 sem_init 是 Posix 线程库的初始化器(因此被用户空间代码使用)。
见主题:基础理论和图书馆