Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Semaphore, Shared Memory and IPC Functions : shm_remove

shm_remove

Removes shared memory from Unix systems (PHP 4, PHP 5)
bool shm_remove ( int shm_identifier )


Code Examples / Notes » shm_remove

cu

Though it says **shm_identifier** in
<PRE>
 int shm_remove(int shm_identifier);
</PRE>
and
<PRE>
 shm_attach() returns an **id** that that can be used to access the System V...
</PRE>
a snippet like this:
<PRE>
 $key = 1234;
 $shm=shm_attach($key);
 // do whatever...
 shm_remove($shm);
</PRE>
produces an error like
Warning: 2(which is the value of $shm) is not a existing SysV shared memory key in /usr/cu/web/sema.php on line 44...
The documentation confused me a bit. I thought shm_remove would get the shm handle/id that returns from shm_attach, not the key given to shm_attach. So, use instead:
<PRE>
 shm_remove($key);
</PRE>
which is what is intended indeed.


aaron durp segura durp gmail durp com

It appears that you must be connected to the shm segment in order to remove it.
<?php
shm_remove($shm);
shm_detach($shm);
?>
works, while
<?php
shm_detach($shm);
shm_remove($shm);
?>
produces "Warning: shm_remove(): The parameter is not a valid shm_identifier ..."


Change Language


Follow Navioo On Twitter
ftok
msg_get_queue
msg_receive
msg_remove_queue
msg_send
msg_set_queue
msg_stat_queue
sem_acquire
sem_get
sem_release
sem_remove
shm_attach
shm_detach
shm_get_var
shm_put_var
shm_remove_var
shm_remove
eXTReMe Tracker