note 16651 modified in function.shmop-open by zak
| From: | zak@php.net | Date: | Thu, 15 Nov 2001 23:12:42 +0000 |
| Subject: | note 16651 modified in function.shmop-open by zak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20894@lists.php.net to get a copy of this message | ||
To check whether a particular shared memory segment is already created, you need to concatenate the
"a" and "c" flags. For example (where $SystemKey is the Unix key used by the
other process(es) with which you want to share this memory segment)...<BR>
$shm_id = shmop_open($SystemKey, "ac", 0, 0);
if ($shm_id) {
#it is already created
} else {
#you need to create it with shmop_open using "c" only
}<BR>
Using only "a" does not work (just as using only IPC_EXCL in the Unix shmget() call is
meaningless). Also, use the ipcs shell command to see your shared memory segments.
--was--
To check whether a particular shared memory segment is already created, you need to OR the
"a" and "c" flags. For example (where $SystemKey is the Unix key used by the
other process(es) with which you want to share this memory segment)...<BR>
$shm_id = shmop_open($SystemKey, "a" | "c", 0, 0);
if ($shm_id) {
<it is already created>
} else {
<you need to create it with shmop_open using "c" only>
}<BR>
Using only "a" does not work (just as using only IPC_EXCL in the Unix shmget() call is
meaningless). Also, use the ipcs shell command to see your shared memory segments.
http://www.php.net/manual/en/function.shmop-open.php