diff --git a/functions/sem.xml b/functions/sem.xml index 3a4ee5289a..f1930993dd 100644 --- a/functions/sem.xml +++ b/functions/sem.xml @@ -1,28 +1,28 @@ - Semaphore and shared memory functions + Semaphore and Shared Memory Functions Semaphore - - - This module provides semaphore functions using System V semaphores. - Semaphores may be used to provide exclusive access to resources - on the current machine, or to limit the number of processes that - may simultaneously use a resource. - - This module provides also shared memory functions using System V - shared memory. Shared memory may be used to provide access to - global variables. Different httpd-daemons and even other programs - (such as Perl, C, ...) are able to access this data to provide a - global data-exchange. Remember, that shared memory is NOT safe - against simultaneous access. Use semaphores for synchronization. + + + This module provides semaphore functions using System V + semaphores. Semaphores may be used to provide exclusive access to + resources on the current machine, or to limit the number of + processes that may simultaneously use a resource. + + + This module provides also shared memory functions using System V + shared memory. Shared memory may be used to provide access to + global variables. Different httpd-daemons and even other programs + (such as Perl, C, ...) are able to access this data to provide a + global data-exchange. Remember, that shared memory is NOT safe + against simultaneous access. Use semaphores for synchronization. - Limits of shared memory by the Unix OS + Limits of Shared Memory by the Unix OS SHMMAX - max size of shared memory, normally 131072 - bytes + max size of shared memory, normally 131072 bytes SHMMIN @@ -30,60 +30,64 @@ SHMMNI - max amount of shared memory segments, normally - 100 + max amount of shared memory segments, normally 100 SHMSEG - max amount of shared memory per process, normally - 6 + max amount of shared memory per process, normally 6 -
- + +
sem_get - get a semaphore id + Get a semaphore id Description int sem_get int key - int max_acquire - - int perm - + int + max_acquire + + int + perm + Returns: A positive semaphore identifier on success, or false on - error. + error. + - sem_get returns an id that can be used to + Sem_get returns an id that can be used to access the System V semaphore with the given key. The semaphore is created if necessary using the permission bits specified in perm (defaults to 0666). The number of processes that can acquire the semaphore simultaneously is set to max_acquire (defaults to 1). Actually this value is set only if the process - finds it is the only process currently attached to the semaphore. + finds it is the only process currently attached to the semaphore. + A second call to sem_get for the same key will return a different semaphore identifier, but both - identifiers access the same underlying semaphore. + identifiers access the same underlying semaphore. + See also: sem_acquire and - sem_release. + sem_release. + sem_acquire - acquire a semaphore + Acquire a semaphore Description @@ -92,27 +96,31 @@ int sem_identifier - Returns: true on success, false on error + Returns: true on success, false on error. + - sem_acquire blocks (if necessary) until the + Sem_acquire blocks (if necessary) until the semaphore can be acquired. A process attempting to acquire a semaphore which it has already acquired will block forever if acquiring the semaphore would cause its max_acquire value to - be exceeded. + be exceeded. + After processing a request, any semaphores acquired by the process but not explicitly released will be released automatically - and a warning will be generated. + and a warning will be generated. + See also: sem_get and - sem_release. + sem_release. + sem_release - release a semaphore + Release a semaphore Description @@ -121,17 +129,21 @@ int sem_identifier - Returns: true on success, false on error + Returns: true on success, false on error. + - sem_release releases the semaphore if it + Sem_release releases the semaphore if it is currently acquired by the calling process, otherwise - a warning is generated. + a warning is generated. + After releasing the semaphore, sem_acquire - may be called to re-acquire it. + may be called to re-acquire it. + See also: sem_get and - sem_acquire. + sem_acquire. + @@ -146,22 +158,27 @@ int shm_attach int key int - memsize + memsize + int - perm + perm + - shm_attach returns an id that that - can be used to access the System V shared memory with - the given key, the first call creates the shared memory - segment with mem_size (default: sysvshm.init_mem in the configuration file, otherwise - 10000 bytes) and the optional perm-bits (default: 0666). + Shm_attach returns an id that that can be + used to access the System V shared memory with the given key, the + first call creates the shared memory segment with mem_size + (default: sysvshm.init_mem in the configuration file, otherwise + 10000 bytes) and the optional perm-bits (default: 0666). + A second call to shm_attach for the same key will return a different shared memory identifier, but both identifiers access the same underlying - shared memory. memsize and - perm will be ignored. + shared memory. Memsize and + perm will be ignored. + @@ -177,10 +194,11 @@ int shm_identifier - shm_detach disconnects from the shared + Shm_detach disconnects from the shared memory given by the shm_identifier created by shm_attach. Remember, that shared memory - still exist in the Unix system and the data is still present. + still exist in the Unix system and the data is still present. + @@ -197,7 +215,8 @@ Removes shared memory from Unix systems. All data will be - destroyed. + destroyed. + @@ -218,7 +237,8 @@ Inserts or updates a variable with a given variable_key. All variable-types (double, - int, string, array) are supported. + int, string, array) are supported. + @@ -236,9 +256,10 @@ int variable_key - shm_get_var returns the variable with a given + Shm_get_var returns the variable with a given variable_key. The variable is still present - in the shared memory. + in the shared memory. + @@ -257,7 +278,8 @@ Removes a variable with a given variable_key - and frees the occupied memory. + and frees the occupied memory. + @@ -273,7 +295,7 @@ sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil -sgml-default-dtd-file:"../manual.ced" +sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil