Hi! > >>This case fails on mips board routerstation randomly. The root cause is > >>that when main thread call usleep(100) after signal the child threads, > >>no child thread is scheduled to run. So the case fails. > >> > >>I update it to set main thread with a lower priority and child threads > >>with a higher one, then when sched_yield is called in main thread, one > >>of the child threads will be scheduled and run. > >> > >>Signed-off-by: Kang Kai<[email protected]> > >>--- > >> .../interfaces/pthread_cond_signal/1-1.c | 55 > >> ++++++++++++++++++-- > >> 1 files changed, 50 insertions(+), 5 deletions(-) > >> > >>diff --git > >>a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c > >> > >>b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c > >>index bf55b31..51c0cfb 100644 > >>--- > >>a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c > >>+++ > >>b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_signal/1-1.c > >>@@ -11,6 +11,7 @@ > >> */ > >> > >> #define _XOPEN_SOURCE 600 > >>+#define _GNU_SOURCE > >This is open posix testsuite keep that in mind so inserting _GNU_SOURCE > >is not allowed here. > > _GNU_SOURCE is needed by set_affinity(). > I once thought multi-processor will break the sync between main > thread and children threads. Maybe I am wrong that set_affinity() is > not needed.
Ah, then we are missing the _GNU_SOUCE in the affinity.h. > >And as far as I remeber the original problem was that some of the > >threads failed to wake up because the while loop that wakes them was too > >tight. Does inserting sched_yield() there help? > > > > Only insert sched_yield() can NOT make sure the main thread really > sleep. In my test increase usleep to 1000 works. > I still hope the last patch which increase the usleep value can be > accept. If can't, I'll send a V2. Hmm, complicated. What about calling sched_yield() and then doing the usleep with slightly increased time? Ideal solution would of course be synchronization of the main thread with the children so that the main thread would wait until the some child has been scheduled, but that would require more complex code. -- Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
