★ wanayoo — archive 1999 http://www.php.net/manual/function.sem-release.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Semaphore
Quick Reference
Semaphore
* sem_get
* sem_acquire
* sem_release
* shm_attach
* shm_detach
* shm_remove
* shm_put_var
* shm_get_var
* shm_remove_var
Manual: sem_release
View the source code for this pageSearch the site



Previous page
 sem_acquire
shm_attach 
Next page


sem_release

sem_release -- release a semaphore

Description

int sem_release(int sem_identifier);

Returns: true on success, false on error

sem_release() releases the semaphore if it is currently acquired by the calling process, otherwise a warning is generated.

After releasing the semaphore, sem_acquire() may be called to re-acquire it.

See also: sem_get() and sem_acquire().


User Contributed Notes: sem_release


apua@communiplex.com
08-Dec-1999 02:54
The fact that sem_release only resease the semaphore if it is currently acquired by the calling process is, in fact, a misfeature since sometimes (eg in a readers-writers implementation) it is desirable to release a semaphore acquired by another process. In C you can do that. I'm telling this because I was trying to write a chat app in php3 made of two programs: a listener and a speaker. The speaker releases a semaphore to inform that there is a new message in a shared memory var. And listeners wait in that semaphore before outputting the message.


 About Notes


Previous page
 sem_acquire
shm_attach 
Next page



Site Statistics


Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.