V2: mq_timedsend/5-1: make parent has chance to sleep
Hi Caspar,
This is version 2, and update the indention.
Please help me to review it, thanks.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 mq_timedsend/5-1: make parent has chance to sleep
Child process sends the last signal before parent process enter the final sleep sometimes, so sleep in parent will not be interrupted then the case fails.
Sleep 1 second before send the last signal in child to make sure parent enter the final sleep.
--- .../conformance/interfaces/mq_timedsend/5-1.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c +4 -1
@@ -82,6 +82,9 @@ int main()sleep (1 );// give parent time to set up handler for (i=0 ; i<MAXMSG +1 ; i++) {mq_timedsend (gqueue, msgptr,strlen (msgptr),1 , &ts); +/* make sure parent enter the final sleep */ +if (i ==MAXMSG ) +sleep (1 );/* send signal to parent each time message is sent */ kill (getppid (),SIGABRT ); }
@@ -138,4 +141,4 @@ int main() }return PTS_UNRESOLVED ; -} +}
Signature · 13 lines
1.7.5.4 ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] mq_timedsend/5-1: make parent has chance to sleep
Quoted 5 lines · Kang Kai
Child process sends the last signal before parent process enter the final sleep sometimes, so sleep in parent will not be interrupted then the case fails.
Sleep 1 second before send the last signal in child to make sure parent enter the final sleep.
So many sleep() makes me confused.
Anyway, your patch makes sense. so,
Quoted 21 lines
Signed-off-by Kang Kai <[email protected]>--- .../conformance/interfaces/mq_timedsend/5-1.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c +3
-0@@ -82,6 +82,9 @@ int main()sleep (1 );// give parent time to set up handler for (i=0 ; i<MAXMSG +1 ; i++) {mq_timedsend (gqueue, msgptr,strlen (msgptr),1 , &ts); +/* make sure parent enter the final sleep */ +if (i ==MAXMSG ) +sleep (1 );/* send signal to parent each time message is sent */ kill (getppid (),SIGABRT ); }
testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c int main() · line 144
Quoted 6 lines
testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c +1
-1@@ -138,4 +141,4 @@ int main() }return PTS_UNRESOLVED ; -} +}
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH] mq_timedsend/5-1: make parent has chance to sleep
In reply to Kang KaiHi!
Quoted 26 lines
Child process sends the last signal before parent process enter the final sleep sometimes, so sleep in parent will not be interrupted then the case fails.
Sleep 1 second before send the last signal in child to make sure parent enter the final sleep.Signed-off-by Kang Kai <[email protected]>--- .../conformance/interfaces/mq_timedsend/5-1.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c +3
-0@@ -82,6 +82,9 @@ int main()sleep (1 );// give parent time to set up handler for (i=0 ; i<MAXMSG +1 ; i++) {mq_timedsend (gqueue, msgptr,strlen (msgptr),1 , &ts); +/* make sure parent enter the final sleep */ +if (i ==MAXMSG ) +sleep (1 );/* send signal to parent each time message is sent */ kill (getppid (),SIGABRT ); }
testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c int main() · line 144
Quoted 6 lines
testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/5-1.c +1
-1@@ -138,4 +141,4 @@ int main() }return PTS_UNRESOLVED ; -} +}
Okay, I think I see the possible race condition between the mq_recieve() in parent and the mq_timedsend() in the the child.
Commited, thanks (and sorry for the delay).
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list