{"action":"opened","issue":{"url":"https://api.github.com/repos/yjtxgt276/coen236/issues/5","labels_url":"https://api.github.com/repos/yjtxgt276/coen236/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/yjtxgt276/coen236/issues/5/comments","events_url":"https://api.github.com/repos/yjtxgt276/coen236/issues/5/events","html_url":"https://github.com/yjtxgt276/coen236/issues/5","id":58781537,"number":5,"title":"prj3: px sem synch","user":{"login":"yjtxgt276","id":5161156,"avatar_url":"https://avatars.githubusercontent.com/u/5161156?v=3","gravatar_id":"","url":"https://api.github.com/users/yjtxgt276","html_url":"https://github.com/yjtxgt276","followers_url":"https://api.github.com/users/yjtxgt276/followers","following_url":"https://api.github.com/users/yjtxgt276/following{/other_user}","gists_url":"https://api.github.com/users/yjtxgt276/gists{/gist_id}","starred_url":"https://api.github.com/users/yjtxgt276/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yjtxgt276/subscriptions","organizations_url":"https://api.github.com/users/yjtxgt276/orgs","repos_url":"https://api.github.com/users/yjtxgt276/repos","events_url":"https://api.github.com/users/yjtxgt276/events{/privacy}","received_events_url":"https://api.github.com/users/yjtxgt276/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-24T18:23:42Z","updated_at":"2015-02-24T18:23:42Z","closed_at":null,"body":"posix semaphore has a race condition b/w parent and child. Scenario is like:\r\nsem val = 0;\r\nloop\r\nchild try to decr the sem -> blocked\r\n parent's done its job, incr the sem, try to decr the sem right away -> succeed(unblocked\r\nend loop\r\nHere the child seems to never get to grab the sem and thus blocked forever, I temporarily solved it by adding a sleep(1) after  each incr to the sem, so the other process as a chance to get it.\r\nSince the sys v semaphore doesnt have this problem, I suspect that the reason of the issue is because posix sem is not at kernel level, and since the parent is running, the kernel would not grab resources from it and give it to the child who is blocking(not ready?)"}}