'\" t
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
.\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
-.TH SEM_WAIT 3 2010-02-25 "Linux" "Linux Programmer's Manual"
+.TH SEM_WAIT 3 2014-02-26 "Linux" "Linux Programmer's Manual"
.SH NAME
sem_wait, sem_timedwait, sem_trywait \- lock a semaphore
.SH SYNOPSIS
.BI "int sem_timedwait(sem_t *" sem ", const struct timespec *" abs_timeout );
.fi
.sp
-Link with \fI\-lrt\fP or \fI\-pthread\fP.
+Link with \fI\-pthread\fP.
.sp
.in -4n
Feature Test Macro Requirements for glibc (see
The call timed out before the semaphore could be locked.
.\" POSIX.1-2001 also allows EDEADLK -- "A deadlock condition
.\" was detected", but this does not occur on Linux(?).
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR sem_wait (),
+.BR sem_trywait (),
+and
+.BR sem_timedwait ()
+functions are thread-safe.
.SH CONFORMING TO
POSIX.1-2001.
.SH NOTES
.RB "$" " ./a.out 2 3"
About to call sem_timedwait()
sem_post() from handler
-sem_getvalue() from handler; value = 1
sem_timedwait() succeeded
.RB "$" " ./a.out 2 1"
About to call sem_timedwait()
exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);
}
.fi
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR clock_gettime (2),
.BR sem_getvalue (3),
.BR sem_post (3),
.BR sem_overview (7),
.BR time (7)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.