RE: [PHP] semaphore release before acquire warning

2011-05-02 Thread Jeremy Greene
I have had really bad luck with signals. They can be “lost” in more than one 
way.

I thought this was the far more reliable and correct way… at least from that 
point of view.

 

Jeremy

 

From: Nathan Nobbe [mailto:quickshif...@gmail.com] 
Sent: Monday, May 02, 2011 5:01 PM
To: Jeremy Greene
Cc: php-general@lists.php.net
Subject: Re: [PHP] semaphore release before acquire warning

 

On Mon, May 2, 2011 at 2:57 PM, Jeremy Greene  wrote:

Hi,



I am getting a warning when calling sem_release() before (the same php
script) calls sem_acquire(). I am doing this because it's a "signal" to
another process. The other process (which happens to be C program) has
done, or will do, a semop() to acquire the semaphore/signal. The actual
data transfer is through shared memory.



It does all functionally work quite nicely, but given that I'm getting
the warning and that there doesn't seem to be any discussion of this at
least in this list's archive maybe I'm putting a square peg into a round
hole... or at least there's a rounder peg available.



I did look into disabling the warning, but that got me more concerned
since it seemed like a frowned upon thing to do and even more of a
performance hit.



The irony is that I'm using shared memory (and signals) exactly for
performance reasons L

 

perhaps try pcntl_signal() to signal the c program rather than sem_release().

 

-nathan



Re: [PHP] semaphore release before acquire warning

2011-05-02 Thread Nathan Nobbe
On Mon, May 2, 2011 at 2:57 PM, Jeremy Greene  wrote:

> Hi,
>
>
>
> I am getting a warning when calling sem_release() before (the same php
> script) calls sem_acquire(). I am doing this because it's a "signal" to
> another process. The other process (which happens to be C program) has
> done, or will do, a semop() to acquire the semaphore/signal. The actual
> data transfer is through shared memory.
>
>
>
> It does all functionally work quite nicely, but given that I'm getting
> the warning and that there doesn't seem to be any discussion of this at
> least in this list's archive maybe I'm putting a square peg into a round
> hole... or at least there's a rounder peg available.
>
>
>
> I did look into disabling the warning, but that got me more concerned
> since it seemed like a frowned upon thing to do and even more of a
> performance hit.
>
>
>
> The irony is that I'm using shared memory (and signals) exactly for
> performance reasons L


perhaps try pcntl_signal() to signal the c program rather than
sem_release().

-nathan


[PHP] semaphore release before acquire warning

2011-05-02 Thread Jeremy Greene
Hi,

 

I am getting a warning when calling sem_release() before (the same php
script) calls sem_acquire(). I am doing this because it's a "signal" to
another process. The other process (which happens to be C program) has
done, or will do, a semop() to acquire the semaphore/signal. The actual
data transfer is through shared memory.

 

It does all functionally work quite nicely, but given that I'm getting
the warning and that there doesn't seem to be any discussion of this at
least in this list's archive maybe I'm putting a square peg into a round
hole... or at least there's a rounder peg available.

 

I did look into disabling the warning, but that got me more concerned
since it seemed like a frowned upon thing to do and even more of a
performance hit.

 

The irony is that I'm using shared memory (and signals) exactly for
performance reasons L

 

Jeremy