Sorry for the bad formatting... 
Anyway, I did figure out the problem: php creates/expects each system v
semaphore to be a semaphore group of 3. So, not only is that weird, it
really should be documented.

Jeremy

-----Original Message-----
From: Jeremy Greene [mailto:jer...@zeevee.com] 
Sent: Wednesday, May 04, 2011 8:14 AM
To: php-general@lists.php.net
Subject: [PHP] sem_get invalid argument for existing semaphore

Hi,

 

I am trying to do a sem_get on a semaphore that has already been created
by

a c++ program. But I'm getting this warning:

 

PHP Warning:  sem_get(): failed for key 0x31006dc2: Invalid argument in
/home/jgreene/views/latest/lcast/apps/webapp/webApp.php on line 11

 

Here is the line 11:

    sem_get($key, 1, 0666);

 

And here is ipcs -s before and after the php script runs:

 

------ Semaphore Arrays --------

key        semid      owner      perms      nsems     

0x31006dc2 1245191    jgreene   666        1         

0x31006e01 1277960    jgreene   666        1         

 

I have another c++ program that can get the existing sem with no
problem.

 

I can get the php script to create a new sem with no problem.

 

It does not seem to like to get a sem that's already created... although
I haven't tried getting a sem that's been created by another php
script... But the entire point is that php is an ephemeral client and a
C++ app server creates and responds/locks a resource (in this case
shared memory - which does work fine).

 

Btw, in the archives, way back in 2001, there was a pretty much exact
same post... unfortunately there was no conclusion posted... I really
hope I have better luck!!

 

Jeremy

 

 

 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to