From d4a22be21479c3b52e0ba2d3cfb150a98c426422 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 13 May 2005 14:21:30 +0000 Subject: '' --- manual/sem_init.html | 58 +++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'manual/sem_init.html') diff --git a/manual/sem_init.html b/manual/sem_init.html index 5509859..80e0580 100644 --- a/manual/sem_init.html +++ b/manual/sem_init.html @@ -5,7 +5,7 @@ SEMAPHORES(3) manual page - + @@ -25,15 +25,15 @@ unsigned int value);

int sem_wait(sem_t * sem);

-

int sem_timedwait(sem_t * sem, -const struct timespec *abstime); +

int sem_timedwait(sem_t * sem, const struct +timespec *abstime);

int sem_trywait(sem_t * sem);

int sem_post(sem_t * sem);

-

int sem_post_multiple(sem_t * sem, int -number); +

int sem_post_multiple(sem_t * sem, int +number);

int sem_getvalue(sem_t * sem, int * sval);

@@ -56,8 +56,8 @@ if pshared is not zero.

sem_wait atomically decrements sem's count if it is greater than 0 and returns immediately or it suspends the calling -thread until it can resume following a call to sem_post -or sem_post_multiple.

+thread until it can resume following a call to sem_post or +sem_post_multiple.

sem_timedwait atomically decrements sem's count if it is greater than 0 and returns immediately, or it suspends the calling thread. If abstime time arrives before the thread can @@ -65,31 +65,29 @@ resume following a call to sem_post or sem_post_multiple, then sem_timedwait returns with a return code of -1 after having set errno to ETIMEDOUT. If the call can return without suspending then abstime is not checked.

-

sem_trywait atomically -decrements sem's count if it is greater than 0 and returns -immediately, or it returns immediately with a return code of -1 after -having set errno to EAGAIN. sem_trywait -never blocks.

+

sem_trywait atomically decrements sem's count if it +is greater than 0 and returns immediately, or it returns immediately +with a return code of -1 after having set errno to EAGAIN. +sem_trywait never blocks.

sem_post either releases one thread if there are any waiting on sem, or it atomically increments sem's count.

sem_post_multiple either releases multiple threads if there -are any waiting on sem and/or -it atomically increases sem's count. If there are -currently n waiters, where n the largest number less -than or equal to number, then n waiters are released -and sem's count is incremented by number minus n.

+are any waiting on sem and/or it atomically increases sem's +count. If there are currently n waiters, where n the +largest number less than or equal to number, then n +waiters are released and sem's count is incremented by number +minus n.

sem_getvalue stores in the location pointed to by sval the current count of the semaphore sem. In the Pthreads-w32 implementation: if the value returned in sval is greater than or equal to 0 it was the sem's count at some point during the -call to sem_getvalue. If the -value returned in sval is less than 0 then it's absolute value -represents the number of threads waiting on sem at some point -during the call to sem_getvalue. POSIX -does not require an implementation of sem_getvalue +call to sem_getvalue. If the value returned in sval is +less than 0 then it's absolute value represents the number of threads +waiting on sem at some point during the call to sem_getvalue. +POSIX does not require an implementation of sem_getvalue to return a value in sval that is less than 0, but if it does -then it's absolute value must represent the number of waiters.

+then it's absolute value must represent the number of waiters.

sem_destroy destroys a semaphore object, freeing the resources it might hold. No threads should be waiting on the semaphore at the time sem_destroy is called.

@@ -110,12 +108,12 @@ codes on error:
EINVAL
- value exceeds the maximal counter value _POSIX_SEM_VALUE_MAX + value exceeds the maximal counter value SEM_VALUE_MAX
ENOSYS
-
+
pshared is not zero

The sem_timedwait function sets errno to the @@ -126,7 +124,7 @@ following error code on error:

ETIMEDOUT
-
+
if abstime arrives before the waiting thread can resume following a call to sem_post or sem_post_multiple.
@@ -138,7 +136,7 @@ error code on error:
EAGAIN
-
+
if the semaphore count is currently 0

The sem_post and sem_post_multiple functions set @@ -149,8 +147,8 @@ if the semaphore count is currently 0

ERANGE
if after incrementing, the semaphore count would exceed - _POSIX_SEM_VALUE_MAX (the semaphore count is left unchanged - in this case) + SEM_VALUE_MAX (the semaphore count is left unchanged in this + case)

@@ -199,4 +197,4 @@ error code on error:

- + \ No newline at end of file -- cgit v1.2.3