logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

sem_post.3p (3480B)


  1. '\" et
  2. .TH SEM_POST "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. sem_post
  12. \(em unlock a semaphore
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <semaphore.h>
  17. .P
  18. int sem_post(sem_t *\fIsem\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIsem_post\fR()
  23. function shall unlock the semaphore referenced by
  24. .IR sem
  25. by performing a semaphore unlock operation on that semaphore.
  26. .P
  27. If the semaphore value resulting from this operation is positive, then
  28. no threads were blocked waiting for the semaphore to become unlocked;
  29. the semaphore value is simply incremented.
  30. .P
  31. If the value of the semaphore resulting from this operation is zero,
  32. then one of the threads blocked waiting for the semaphore shall be
  33. allowed to return successfully from its call to
  34. \fIsem_wait\fR().
  35. If the Process Scheduling option is supported, the thread to be
  36. unblocked shall be chosen in a manner appropriate to the scheduling
  37. policies and parameters in effect for the blocked threads. In the case
  38. of the schedulers SCHED_FIFO and SCHED_RR,
  39. the highest priority waiting thread shall be unblocked, and if there is
  40. more than one highest priority thread blocked waiting for the
  41. semaphore, then the highest priority thread that has been waiting the
  42. longest shall be unblocked. If the Process Scheduling option is not
  43. defined, the choice of a thread to unblock is unspecified.
  44. .P
  45. If the Process Sporadic Server option is supported, and the scheduling
  46. policy is SCHED_SPORADIC, the semantics are as per SCHED_FIFO above.
  47. .P
  48. The
  49. \fIsem_post\fR()
  50. function shall be async-signal-safe and may be invoked from a
  51. signal-catching function.
  52. .SH "RETURN VALUE"
  53. If successful, the
  54. \fIsem_post\fR()
  55. function shall return zero; otherwise, the function shall return \-1
  56. and set
  57. .IR errno
  58. to indicate the error.
  59. .SH ERRORS
  60. The
  61. \fIsem_post\fR()
  62. function may fail if:
  63. .TP
  64. .BR EINVAL
  65. The
  66. .IR sem
  67. argument does not refer to a valid semaphore.
  68. .LP
  69. .IR "The following sections are informative."
  70. .SH EXAMPLES
  71. See
  72. .IR "\fIsem_timedwait\fR\^(\|)".
  73. .SH "APPLICATION USAGE"
  74. None.
  75. .SH RATIONALE
  76. None.
  77. .SH "FUTURE DIRECTIONS"
  78. None.
  79. .SH "SEE ALSO"
  80. .IR "\fIsemctl\fR\^(\|)",
  81. .IR "\fIsemget\fR\^(\|)",
  82. .IR "\fIsemop\fR\^(\|)",
  83. .IR "\fIsem_timedwait\fR\^(\|)",
  84. .IR "\fIsem_trywait\fR\^(\|)"
  85. .P
  86. The Base Definitions volume of POSIX.1\(hy2017,
  87. .IR "Section 4.12" ", " "Memory Synchronization",
  88. .IR "\fB<semaphore.h>\fP"
  89. .\"
  90. .SH COPYRIGHT
  91. Portions of this text are reprinted and reproduced in electronic form
  92. from IEEE Std 1003.1-2017, Standard for Information Technology
  93. -- Portable Operating System Interface (POSIX), The Open Group Base
  94. Specifications Issue 7, 2018 Edition,
  95. Copyright (C) 2018 by the Institute of
  96. Electrical and Electronics Engineers, Inc and The Open Group.
  97. In the event of any discrepancy between this version and the original IEEE and
  98. The Open Group Standard, the original IEEE and The Open Group Standard
  99. is the referee document. The original Standard can be obtained online at
  100. http://www.opengroup.org/unix/online.html .
  101. .PP
  102. Any typographical or formatting errors that appear
  103. in this page are most likely
  104. to have been introduced during the conversion of the source files to
  105. man page format. To report such errors, see
  106. https://www.kernel.org/doc/man-pages/reporting_bugs.html .