字体:  

ACE_File_Lock open failed

peakzhang 发表于: 2008-5-21 23:23 来源: ACE 开发者

我想用ACE_File_Lock 来保证我的运行实例唯一..
但在window 下..
ACE_File_Lock fk;
if (fk.open ("cccccccccc", O_RDWR))
   ACE_OS::printf ("open failed\n");
open failed
为何..有没有其他的通用的保证实例唯一性的方法...

最新回复

peakzhang at 2008-5-21 23:23:31
Do u have "cccccccccc" ready?
Do u have right permission?
....
Come on guys, why it's so difficult to printf("err %d\n", ACE_OS::last_error());
You just make simple question become a guessing game.
peakzhang at 2008-5-21 23:23:39
我看代码.它应该是会自己创建一个文件的..

刚才我自己touch了一个文件,open成功了..

但if (fk.tryacquire_write () == -1)
        ACE_OS::printf ("write failed\n");

失败..
peakzhang at 2008-5-21 23:23:46
is O_RDWR|O_CREATE will be helpful.
Again, errno!