public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: moore@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Avoid spurious waits in CountDownLatch.await Date: Thu, 22 Nov 2007 20:53:00 -0000 [thread overview] Message-ID: <20071122205327.10260.qmail@sourceware.org> (raw) The branch, master has been updated via d7c815e89593b5133268c9574950ca09b01eb6c7 (commit) from 943add0b4c20c6965b068c3a5e8923d367441abf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit d7c815e89593b5133268c9574950ca09b01eb6c7 Author: Tim Moore <moore@blackbox.bricoworks.com> Date: Thu Nov 22 18:29:35 2007 +0100 Avoid spurious waits in CountDownLatch.await frysk-core/frysk/util/ChangeLog 2007-11-22 Tim Moore <timoore@redhat.com> * CountDownLatch.java (await): Loop to avoid spurious wakeup. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/util/ChangeLog | 4 ++++ frysk-core/frysk/util/CountDownLatch.java | 27 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog index 5c50a53..0eb921d 100644 --- a/frysk-core/frysk/util/ChangeLog +++ b/frysk-core/frysk/util/ChangeLog @@ -1,3 +1,7 @@ +2007-11-22 Tim Moore <timoore@redhat.com> + + * CountDownLatch.java (await): Loop to avoid spurious wakeup. + 2007-11-21 Sami Wagiaalla <swagiaal@redhat.com> * StacktraceAction.java: Now passes numberOfFrames argument. diff --git a/frysk-core/frysk/util/CountDownLatch.java b/frysk-core/frysk/util/CountDownLatch.java index a972cfd..b191782 100644 --- a/frysk-core/frysk/util/CountDownLatch.java +++ b/frysk-core/frysk/util/CountDownLatch.java @@ -55,18 +55,33 @@ public class CountDownLatch { public void await() throws InterruptedException { - await(0); + while (count != 0) { + try { + wait(); + } + catch (InterruptedException e) { + throw e; + } + } } public synchronized boolean await(long timeout) throws InterruptedException { if (count == 0) return true; - try { - wait(timeout); - } - catch (InterruptedException e) { - throw e; + long now = System.currentTimeMillis(); + while (count != 0) { + long later = now + timeout; + try { + wait(timeout); + } + catch (InterruptedException e) { + throw e; + } + now = System.currentTimeMillis(); + if (now >= later) + break; + timeout = later - now; } // Either the count is 0 or we timed out return count == 0; hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2007-11-22 20:53 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20071122205327.10260.qmail@sourceware.org \ --to=moore@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).