This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Semaphores in libc


On Thu, Dec 31, 2009 at 02:25:07PM +0000, Paulo J. Matos wrote:
>   sem_t *s = sem_open("/cvsa_driver_sem", O_CREAT, O_RDWR, 1);

Instead of O_RDWR, you should specify the permissions for the created
file. Like 0600.

>   sem_wait(s);

Don't forget to check if the wait was interrupted.

With the change I mentioned, your program works fine in my computer. I
didn't test without the change.

-- 
lfr
0/0

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]