Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sem_acquire second argument is not working #8468

Open
juanfernandoe opened this issue Mar 21, 2019 · 0 comments
Open

sem_acquire second argument is not working #8468

juanfernandoe opened this issue Mar 21, 2019 · 0 comments

Comments

@juanfernandoe
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant