ACE_Remote_Mutex如何运作?

时间:2011-03-05 16:38:35

标签: token ace

我写了两个小程序试图获得名为“The Token”的相同Remote Mutex:

ACE_Remote_Mutex token("The Token", 1, 1);
token.acquire();
ACE_OS::sleep(5);
token.release();
return 0;

他们都得到了以下调试输出:

(3078597488) acquired The Token
(4243|3078597488) BIG PROBLEMS with get_connection: Connection refused
error on remote acquire, releasing shadow mutex.
(3078597488) released The Token, owner is no owner
(4243|3078597488) BIG PROBLEMS with get_connection: Connection refused
(3078597488) release failed: Permission denied.
(3078597488) shadow: release failed

ACE_Remote_Mutex是否仅适用于Corba经纪人等某种“代理人”?我可以修改我的代码吗?

1 个答案:

答案 0 :(得分:0)

Remote_Mutex使用令牌服务获取锁定。令牌服务不是CORBA服务,但它起着类似的作用。以下是动态启动令牌服务的svc.conf条目示例:

dynamic Token_Service Service_Object * 
          ../lib/netsvcs:_make_ACE_Token_Acceptor() 
          "-p 10202"