的fcntl()的线程或进程同步? [英] fcntl() for thread or process synchronization?
本文介绍了的fcntl()的线程或进程同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能使用的fcntl()系统调用上的一个文件来实现线程/进程的同步(而不是semaphoress)?
Is it possible to use fcntl() system call on a file to achieve thread/process synchronization (instead of semaphoress)?
推荐答案
是的。 UNIX的fcntl锁(和文件系统资源一般)是全系统的,所以任何执行两个线程(被他们单独的进程或没有)可以使用它们。这是否是一个好主意与否是上下文相关的。
Yes. Unix fcntl locks (and filesystem resources in general) are system-wide, so any two threads of execution (be they separate processes or not) can use them. Whether that's a good idea or not is context-dependent.
这篇关于的fcntl()的线程或进程同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文