Re: prevent multiple start of app



reppisch wrote:

That's not correct.

sem_open(const char *name, int oflag, ...);

is for creating inter-process semaphores.

We use it extensively for communicating between
multiple unrelated processes.

All the processes must know is the semaphore name.

Regards,
Larry

man 3 sem_init says the following about this:
...
sem_init initializes the semaphore object pointed to by sem. The count
associated with the semaphore is set initially to value. The pshared
argument indicates whether the semaphore is local to the current pro-
cess ( pshared is zero) or is to be shared between several processes (
pshared is not zero).

LinuxThreads currently does not support process-
shared semaphores, thus sem_init always returns with error ENOSYS if
pshared is not zero
...

System is a Red Hat Linux release 9 (Shrike) 2.4.20-8 #1

Am i missing something?
btw: I know that the system is not the cutting edge ;-) but required for
some ancient drivers for very special hardware.


Ok, one more time...

That's sem_open(), NOT sem_init().

They're two different semaphore systems.

Larry
.



Relevant Pages

  • Re: Is there a way to get the current semaphore count?
    ... Is there a way to get the semaphore ... single exception to this and make a call with a release count of zero ... for a thread, then if the message count exceeds some threshold, the ... message receiving thread could speeds up it's message processing by ...
    (microsoft.public.vc.language)
  • Re: Is there a way to get the current semaphore count?
    ... Is there a way to get the semaphore ... so why make a release count of zero call ... A semaphore used to represent the count of messages in a fifo message ... queue, combined with a mutex for ownership of that queue during updates, ...
    (microsoft.public.vc.language)
  • Re: "Semaphore" - Was ist das?
    ... The semaphore cannot be set again. ... A semaphore object is a synchronization object that maintains a count ... between zero and a specified maximum value. ... The application specifies the semaphore object ...
    (microsoft.public.de.excel)
  • Re: Is there a way to get the current semaphore count?
    ... as an optional output parameter, so why make a release count of zero call ... with a count of 1 followed by a WaitForObjectfor that semaphore ... the dequeuing thread that uses WaitForMultipleObjects() on both the ...
    (microsoft.public.vc.language)
  • Re: Recursive mutex
    ... Use two additional fields for each recursive mutex: ... If the thread id is not equal request the semaphore. ... field and set the usage counter to 1. ... If the counter reaches zero, invalidate the thread id field and ...
    (comp.programming.threads)