From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: DAN LI <li.dan@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH]pthread_cond_broadcast/1-2.c
Date: Tue, 03 Jul 2012 15:56:56 +0800 [thread overview]
Message-ID: <4FF2A5C8.2060806@cn.fujitsu.com> (raw)
In-Reply-To: <4FF29C81.9040600@cn.fujitsu.com>
On 07/03/2012 03:17 PM, DAN LI wrote:
> Case pthread_cond_broadcast/1-2.c trys to create as many threads and
> processes as possible which will wait on a condition variable.
>
> Unfortunately,if some thread or child process waits overtime(180s)
> since maybe memory is not enough or whatever, it will call FAILED() and
> exit without unlocking a global mutex.
>
> Above-mentioned matter leads to a deadlock when parent process trys to
> pthread_mutex_lock the global mutex,and obviously status FAILED cannot
> be reahed by parent process.
>
> This patch fixes the deadlock problem.
>
pushed, thanks,
Wanlong Gao
> Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
> ---
> .../interfaces/pthread_cond_broadcast/1-2.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c
> index af826ba..f6ad9df 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_cond_broadcast/1-2.c
> @@ -189,9 +189,13 @@ static void *child(void *arg)
> timed, td->predicate, ret);
> #endif
> } while ((ret == 0) && (td->predicate == 0));
> - if (ret == ETIMEDOUT)
> + if (ret == ETIMEDOUT) {
> + ret = pthread_mutex_unlock(&td->mtx);
> + if (ret != 0)
> + UNRESOLVED(ret, "Failed to unlock the mutex.");
> FAILED("Timeout occured. This means a cond signal was lost -- "
> "or parent died");
> + }
> if (ret != 0)
> UNRESOLVED(ret, "Failed to wait for the cond");
>
> -- 1.7.7.2
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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-03 7:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-03 7:17 [LTP] [PATCH]pthread_cond_broadcast/1-2.c DAN LI
2012-07-03 7:56 ` Wanlong Gao [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=4FF2A5C8.2060806@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=li.dan@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