Updated documentattion and license

This commit is contained in:
ftc
2019-09-15 14:42:19 +03:00
parent 213cf2d810
commit 2b0d36a268
2 changed files with 64 additions and 11 deletions
+10 -11
View File
@@ -1,14 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Copyright 2019 Denis "ftc" Denisov
Version 2, December 2004 Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> http://www.apache.org/licenses/LICENSE-2.0
Everyone is permitted to copy and distribute verbatim or modified copies of Unless required by applicable law or agreed to in writing, software
this license document, and changing it is allowed as long as the name is changed. distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE See the License for the specific language governing permissions and
limitations under the License.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
+54
View File
@@ -69,10 +69,64 @@ Returns `true` on success, `false` otherwise.
### posix_sem_post($semaphore) ### posix_sem_post($semaphore)
Unlocks semaphore. If the semaphore's value consequently becomes greater than zero, then
another process or thread blocked in a sem_wait call will be woken
up and proceed to lock the semaphore.
Parameters:
* $semaphore - semaphore resource to unlock (acquired via `posix_sem_open`).
Returns `true` on success, `false` otherwise.
### posix_sem_wait($semaphore) ### posix_sem_wait($semaphore)
Locks a semaphore. If
the semaphore's value is greater than zero, then the decrement
proceeds, and the function returns, immediately. If the semaphore
currently has the value zero, then the call blocks until either it
becomes possible to perform the decrement (i.e., the semaphore value
rises above zero), or a signal handler interrupts the call.
Parameters:
* $semaphore - semaphore resource to unlock (acquired via `posix_sem_open`).
Returns `true` on success, `false` otherwise.
### posix_sem_trywait($semaphore)
The same as `posix_sem_wait`, except that if the decrement
cannot be immediately performed, then call returns an error (last error
set to EAGAIN) instead of blocking.
### posix_sem_timedwait($semaphore, $timeout_sec, $timeout_nsec = 0)
Tries to lock a semaphore (as `posix_sem_wait`), but if lock could not
be performed in a specified timeout, returns and sets last error to ETIMEDOUT.
Parameters:
* $semaphore - semaphore resource to unlock (acquired via `posix_sem_open`).
* $timeout_sec - part of the timeout in seconds.
* $timeout_nsec - part of the timeout in nanoseconds.
Total timeout is computed as `$timeout_sec * 1000000000 + $timeout_nsec` and is
measured in nanoseconds.
### posix_sem_getvalue($semaphore) ### posix_sem_getvalue($semaphore)
Gets value of specified semaphore.
Parameters:
* $semaphore - semaphore resource which value to get (acquired via `posix_sem_open`).
Returns semaphore value on success and `null` on error.
Please note that underlying function `sem_getvalue` can behave differently according to
POSIX specification, so please read your OS documentation on that.
### posix_sem_error()
Returns value of last error occured during call of another semaphore-related function.
## Notes for PHP users ## Notes for PHP users