sem_wait.3 (51f2ddd7af07ee09e4491db48435add85c117b4c) sem_wait.3 (9d09157a0f55ef695b75eafb407f57206453a1f1)
1.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 45 unchanged lines hidden (view full) ---

54.Fn sem_trywait
55function decrements (locks) the semaphore pointed to by
56.Fa sem
57only if the value is non-zero. Otherwise, the semaphore is not decremented and
58an error is returned.
59.Sh RETURN VALUES
60.Rv -std
61.Sh ERRORS
1.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 45 unchanged lines hidden (view full) ---

54.Fn sem_trywait
55function decrements (locks) the semaphore pointed to by
56.Fa sem
57only if the value is non-zero. Otherwise, the semaphore is not decremented and
58an error is returned.
59.Sh RETURN VALUES
60.Rv -std
61.Sh ERRORS
62The
62.Fn sem_wait
63and
64.Fn sem_trywait
63.Fn sem_wait
64and
65.Fn sem_trywait
65will fail if:
66functions will fail if:
66.Bl -tag -width Er
67.It Bq Er EINVAL
68.Fa sem
69points to an invalid semaphore.
70.El
71.Pp
72Additionally,
73.Fn sem_trywait
74will fail if:
75.Bl -tag -width Er
76.It Bq Er EAGAIN
77The semaphore value was zero, and thus could not be decremented.
78.El
79.Sh SEE ALSO
80.Xr sem_post 3 ,
81.Xr sem 4
82.Sh STANDARDS
67.Bl -tag -width Er
68.It Bq Er EINVAL
69.Fa sem
70points to an invalid semaphore.
71.El
72.Pp
73Additionally,
74.Fn sem_trywait
75will fail if:
76.Bl -tag -width Er
77.It Bq Er EAGAIN
78The semaphore value was zero, and thus could not be decremented.
79.El
80.Sh SEE ALSO
81.Xr sem_post 3 ,
82.Xr sem 4
83.Sh STANDARDS
84The
83.Fn sem_wait
84and
85.Fn sem_trywait
85.Fn sem_wait
86and
87.Fn sem_trywait
86conform to
88functions conform to
87.St -p1003.1-96 .
89.St -p1003.1-96 .