【 以下文字转载自 Linux 讨论区 】 发信人: noid (DoIneedit?), 信区: Linux 标 题: Semaphores in Linux 发信站: BBS 未名空间站 (Sat Jan 10 00:14:53 2009) http://www.linuxdevcenter.com/pub/a/linux/2007/05/24/semaphores-in-linux.html?page=1 in this link, the author says "In general, the older Unix-based systems uses the System V version and the current Linux-based systems use the POSIX version." The System V uses semget()... and POSIX uses sem_init... However, in my company's Linux system, the gcc compiles semget()... succesfu
t*3
5 楼
Asset Pricing是不是给人感觉是体力活的样子?
h*e
6 楼
保险能cover就拔。
T*9
7 楼
头文件不一样
uses
【在 n**d 的大作中提到】 : 【 以下文字转载自 Linux 讨论区 】 : 发信人: noid (DoIneedit?), 信区: Linux : 标 题: Semaphores in Linux : 发信站: BBS 未名空间站 (Sat Jan 10 00:14:53 2009) : http://www.linuxdevcenter.com/pub/a/linux/2007/05/24/semaphores-in-linux.html?page=1 : in this link, the author says "In general, the older Unix-based systems uses : the System V version and the current Linux-based systems use the POSIX : version." : The System V uses semget()... and POSIX uses sem_init... : However, in my company's Linux system, the gcc compiles semget()...
I know the differnce between System V and POSIX for Semaphore. My question is what kind of Semaphore Linux supports, System V or POSIX.
【在 T*****9 的大作中提到】 : 头文件不一样 : : uses
k*m
10 楼
有保险也可能自己负担不小的一部分,还有副作用和风险。 牙医投诉的案例太多,自己谨慎为妙。
【在 h******e 的大作中提到】 : 保险能cover就拔。
T*9
11 楼
try to use the -lphread option when you compiler with gcc
【在 n**d 的大作中提到】 : I know the differnce between System V and POSIX for Semaphore. My question : is what kind of Semaphore Linux supports, System V or POSIX.
n*d
12 楼
Yes, we can use gcc with -lrt or -lpthread to pass compile and link. What does it mean? So can we say Linux supports both kinds of Semaphores?
【在 T*****9 的大作中提到】 : try to use the -lphread option when you compiler with gcc
How do we use System V Semaphores for unrelated processes (not forked one)? Some example code uses Ftok("filename" ...) to generate the key. So if the 2 processes use the same filename then they can get the same key. More often, we use IPC_PRIVATE for the key. In this case, how can the 2 processes get the same key? Does that mean we have to use Ftok() if we want to use Sys V Semaphores for 2 unrelated processes?