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 <[email protected]>
> ---
>  .../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... 

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to