From: Kang Kai <Kai.Kang@windriver.com>
To: gaowanlong@cn.fujitsu.com
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] pthread_cond_signal/1-1: fails on routerstation
Date: Thu, 12 Jul 2012 17:58:07 +0800 [thread overview]
Message-ID: <4FFE9FAF.2080105@windriver.com> (raw)
In-Reply-To: <4FFA435B.2030808@cn.fujitsu.com>
On 2012年07月09日 10:35, Wanlong Gao wrote:
> On 07/03/2012 05:59 PM, Kang Kai wrote:
>> Case pthread_cond_signal/1-1 fails on routerstation. The OS is Yocto
>> linux 1.2 with kernel 3.0.24, and c library is eglibc 2.15.
>>
>> The fail log:
>> [Thread 0x0x2c56d4b0] started and locked the mutex
>> [Thread 0x0x2c56d4b0] is waiting for the cond
>> [Thread 0x0x2bd6d4b0] started and locked the mutex
>> [Thread 0x0x2bd6d4b0] is waiting for the cond
>> [Thread 0x0x2b56d4b0] started and locked the mutex
>> [Thread 0x0x2b56d4b0] is waiting for the cond
>> [Main thread] signals a condition
>> [Thread 0x0x2c56d4b0] was wakened and acquired the mutex again
>> [Thread 0x0x2c56d4b0] released the mutex
>> [Main thread] 1 waiters were wakened
>> [Main thread] signals to wake up the next thread
>> [Thread 0x0x2bd6d4b0] was wakened and acquired the mutex again
>> [Thread 0x0x2bd6d4b0] released the mutex
>> [Main thread] signals to wake up the next thread
>> [Main thread] signals to wake up the next thread
>> [Main thread] signals to wake up the next thread
>> [Main thread] signals to wake up the next thread
>> [Main thread] signals to wake up the next thread
>> [Thread 0x0x2b56d4b0] was wakened and acquired the mutex again
>> [Main thread] had to signal the condition 7 times
>> [Main thread] to wake up 3 threads
>> . Test FAILED.
>>
>> The main thread call pthread_cond_signal try to signal the child threads
>> those are waiting on the condition, then call usleep(100) to relinquish
>> the cpu. But 100 useconds is not enough and the main thread continue to
>> run. So the case fails.
>>
>> Increase the sleep timeto 1000 useconds to make the case pass.
>>
>> Signed-off-by: Kang Kai<kai.kang@windriver.com>
>> ---
>> .../interfaces/pthread_cond_signal/1-1.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 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..910931d 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
>> @@ -142,7 +142,7 @@ int main()
>> fprintf(stderr,"Main failed to signal the condition\n");
>> exit(PTS_UNRESOLVED);
>> }
>> - usleep(100);
>> + usleep(1000);
Hi Wanlong,
> Anyway, just add the hard sleep time can resolve nothing.
> Maybe you can find a better way.
Thanks for your comment.
I sent a new patch for this issue.
But I still think increase the sleep time is ok. At this point main
thread calls usleep() is just want to yield the cpu. For a short sleep
time, the kernel may just busy waiting and no schedule happens. Then the
child thread doesn't have chance to wake up.
A longer sleep time will ensure the child will be scheduled.
And this is the simplest way. :)
Regards,
Kai
>
> Thanks,
> Wanlong Gao
>
>> }
>>
>> if (i>= THREAD_NUM) {
>> @@ -160,4 +160,4 @@ int main()
>> }
>> printf("Test PASSED\n");
>> return PTS_PASS;
>> -}
>> \ No newline at end of file
>> +}
>>
>
>
------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
prev parent reply other threads:[~2012-07-12 9:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-03 9:59 [LTP] [PATCH] pthread_cond_signal/1-1: fails on routerstation Kang Kai
2012-07-09 2:06 ` Kang Kai
2012-07-09 2:35 ` Wanlong Gao
2012-07-12 9:58 ` Kang Kai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FFE9FAF.2080105@windriver.com \
--to=kai.kang@windriver.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox