sem_acquire second argument is not working
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
### HHVM Version
> Please include the output of `hhvm --version` and `hh_client --version`
HipHop VM 3.30.2 (rel)
Compiler: 1547490784_941975033
Repo schema: f6e390de46500754aba5049064f73b133bcb48fb
hh-c15d5f902880f7478651a85a635cf21d449d0b44-3.30.2 Mon Jan 14 13:35:42 2019
### Operating System and Version
Debian GNU/Linux 8 inside Docker
> For example, 'Debian Squeeze', 'Ubuntu 16.04', 'MacOS High Sierra'. Please
> also mention if you are using Docker or similar images.
### Standalone code, or other way to reproduce the problem
```
$seed='12345678';
$key = \ftok($seed, 'm');
$a = \sem_get($key, 1, 0666, 1);
$s = \sem_acquire($a, true);
if ($s == false) {
echo "Task is already running!";
exit(0);
}
echo 'running....\n';
\sleep(10);
```
> This should not depend on installing any libraries or frameworks. Ideally, it
> should be possible to copy-paste this into a single file and reproduce the
> problem by running `hhvm` and/or `hh_client`
### Actual result
> If applicable, please copy-paste output from `hhvm` or `hh_client`
### Expected result
The second instance of the script must print "Task is already running!" but it waits until the first instance finishes then run the remaining code.
Contributor guide
Assessment
This issue has not been assessed yet.