Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Semaphore



Why exactly do you want to avoid ftok? It's a good way to generate shared keys.

It's always possible to generate an integer key some other way yourself and then you just have to figure out how to communicate it across processes. You could write it to a file or send it over a socket.

Luke

Sent from my iPhone.

On Nov 30, 2008, at 3:25 AM, Rakesh Singhal <email@hidden> wrote:

Is it possible to use semget() without using ftok() for IPC communication?

Please suggest me.

Regards
rksinghal

On Fri, Nov 28, 2008 at 9:54 AM, Rakesh Singhal
<email@hidden> wrote:
Thanks. Now I am using following set of APIs:

ftok()
semget()
semop()
semctl()

It is working till now :)

Regards
rksinghal

On Thu, Nov 27, 2008 at 9:49 AM, Terry Lambert <email@hidden> wrote:
On Nov 26, 2008, at 7:31 PM, Rakesh Singhal wrote:

Hi all

I tried to use sem_init() but I think it is not there to use. It is
declared in semaphore.h but when I do man sem_init() then it gives the
message "No manual entry for sem_init".


Now, I am using sem_open(). I think it is right API to create unique
semaphore between multi-processes. But creating it in one process if I
try to create in another process, the value of semaphore is not same.
I am using same name in both process(1st argument of sem_open()).


Please suggest to create semaphore (cross-processes).

POSIX unnamed semaphores are not supported.

Use either POSIX named semaphores, or use System V semaphores:

      man sem_open
      man semget

-- Terry


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >Semaphore (From: "Rakesh Singhal" <email@hidden>)
 >Re: Semaphore (From: Terry Lambert <email@hidden>)
 >Re: Semaphore (From: "Rakesh Singhal" <email@hidden>)
 >Re: Semaphore (From: "Rakesh Singhal" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.