]> git.saurik.com Git - apple/libc.git/blobdiff - sys/sem_wait.2
Libc-498.1.7.tar.gz
[apple/libc.git] / sys / sem_wait.2
index feeff3b77c009924edc958600a0638b8c67728b8..02f8d85864c609e80f70833a1afe5e6b1b28a655 100644 (file)
 .Dt SEM_WAIT 2
 .Os Darwin
 .Sh NAME
-.Nm sem_wait, sem_trywait
+.Nm sem_trywait, sem_wait
 .Nd lock a semaphore
 .Sh SYNOPSIS
 .Fd #include <semaphore.h>
 .Ft int
-.Fn sem_wait "sem_t *sem"
-.Ft int
 .Fn sem_trywait "sem_t *sem"
+.Ft int
+.Fn sem_wait    "sem_t *sem"
 .Sh DESCRIPTION
 The semaphore referenced by
 .Fa sem
 is locked.  When calling
 .Fn sem_wait ,
 if the semaphore's value is zero, the calling thread will block until
-the lock is aquired or until the call is interrupted by a
+the lock is acquired or until the call is interrupted by a
 signal. Alternatively, the
 .Fn sem_trywait
 function will fail if the semaphore is already locked, rather than
 blocking on the semaphore.
 .Pp
-If successful (the lock was aquired),
+If successful (the lock was acquired),
 .Fn sem_wait
 and
 .Fn sem_trywait
@@ -59,13 +59,13 @@ succeed unless:
 .Bl -tag -width Er
 .It Bq Er EAGAIN
 The semaphore is already locked.
-.It Bq Er EINVAL
-.Fa sem
-is not a valid semaphore descriptor.
 .It Bq Er EDEADLK
 A deadlock was detected.
 .It Bq Er EINTR
 The call was interrupted by a signal.
+.It Bq Er EINVAL
+.Fa sem
+is not a valid semaphore descriptor.
 .El
 .Sh NOTES
 Applications may encounter a priority inversion while using
@@ -76,11 +76,11 @@ has occured, and the higher-priority thread will be blocked for an
 unlimited time period.  Programmers using the realtime functionality
 of the system should take care to avoid priority inversions.
 .Sh SEE ALSO
+.Xr sem_open 2 ,
+.Xr sem_post 2 ,
 .Xr semctl 2 ,
 .Xr semget 2 ,
-.Xr semop 2 ,
-.Xr sem_open 2 ,
-.Xr sem_post 2
+.Xr semop 2
 .Sh HISTORY
 .Fn sem_wait
 and