我在 Cygwin 下遇到了 POSIX Semaphores 的问题,我尝试了以下方法:
$ semtool c 1
Attempting to create new semaphore set with 1 members
Bad system call
$
上面的 semtool 尝试创建(通过 semget、semctl 等系统调用)一个新的信号量。但是它不起作用:错误的系统调用。
此外,使用 semget() 的简约测试 C 程序也无法输出相同的消息:系统调用错误。
我已经完成了谷歌搜索:安装了 cygserver,将环境变量 CYGWIN 定义为“服务器”,但没有任何帮助。我的 cygwin 版本非常新:
$ cygcheck -c | grep cygwin
base-cygwin 3.0-1 OK
cygwin 1.7.9-1 OK
cygwin-doc 1.7-1 OK
cygwin-x-doc 1.1.1-1 OK
$
任何想法/提示可能仍然缺少什么?
现在尝试使用额外的导出:
$ export CYGWIN=server
服务正在运行
$ net start | grep -i cyg
CYGWIN cygserver
$
没有更多错误:
$ semtool c 1
Attempting to create new semaphore set with 1 members
$
似乎现在可以工作了!