From: Wanlong G. <gao...@cn...> - 2011-08-16 07:02:59
|
On 08/12/2011 07:59 PM, Cyril Hrubis wrote: > Hi! >> >> If with no sleep, child_3 will preempt and get the lock before child_2 >> some time. It may fail the test case. >> >> Signed-off-by: Wanlong Gao<gao...@cn...> >> --- >> .../conformance/interfaces/sem_post/8-1.c | 3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c >> index 165b094..37ed8a3 100644 >> --- a/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c >> +++ b/testcases/open_posix_testsuite/conformance/interfaces/sem_post/8-1.c >> @@ -174,6 +174,7 @@ int main() >> } >> fprintf(stderr, "P: child_2: %d forked\n", c_2); >> >> + sleep(1); >> /* Make sure the two children has been waiting */ >> /*do { >> sleep(1); >> @@ -254,4 +255,4 @@ clean_up: >> sem_unlink(semname); >> sem_unlink(semname_1); >> return retval; >> -} >> \ No newline at end of file > > While this makes the probability of preempting smaller, the test still > would fail under some cirscumstances. The correct solution would be > check the semafore for number of waiting processes. And the code is > allready there but was commented out some time ago and I wonder why... It's introduced by commit f102fd9735f01b4e2c9ae44f3c90d1a56d4d81f8 Author: Rishikesh K Rajak <ris...@li...> Date: Tue Mar 23 14:20:36 2010 +0530 But now it seems not working fine.... -- Thanks Wanlong Gao |