Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7783

Re: Java thread

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!f24g2000prb.googlegroups.com!not-for-mail
From Jack <junw2000@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Java thread
Date Sat, 10 Sep 2011 22:48:28 -0700 (PDT)
Organization http://groups.google.com
Lines 18
Message-ID <0d62ad20-0081-4bf2-9c5d-ee4600423150@f24g2000prb.googlegroups.com> (permalink)
References <128ea2e0-7a2e-4c86-9507-8e15a0b892b9@p25g2000pri.googlegroups.com>
NNTP-Posting-Host 67.188.150.126
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1315720196 13050 127.0.0.1 (11 Sep 2011 05:49:56 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Sun, 11 Sep 2011 05:49:56 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info f24g2000prb.googlegroups.com; posting-host=67.188.150.126; posting-account=CahHvgoAAAA27gEVS14ggLk784nVIco1
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order HUALESNKRC
X-HTTP-UserAgent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20100101 Firefox/6.0.1,gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7783

Show key headers only | View raw


On Sep 10, 9:03 pm, Jack <junw2...@gmail.com> wrote:
> For Java thread, how to ensure that wait() does not miss notify()?
> Otherwise the thread will hang and can not shut down.
>
> Thanks. Jack

For example in the following code:

while(true)
{
    doSomeThing(); //Do some operation once a day
    wait(24 * 3600); //sleep for one day. LINE1
}

The thread blocks at LINE1 for one day. When the program shuts down,
if the notify() is missing, then the program will hang.

Jack

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Java thread Jack <junw2000@gmail.com> - 2011-09-10 21:03 -0700
  Re: Java thread markspace <-@.> - 2011-09-10 21:34 -0700
  Re: Java thread Patricia Shanahan <pats@acm.org> - 2011-09-10 22:42 -0700
  Re: Java thread Jack <junw2000@gmail.com> - 2011-09-10 22:48 -0700
    Re: Java thread Owen Jacobson <angrybaldguy@gmail.com> - 2011-09-11 03:07 -0400
    Re: Java thread Lew <lewbloch@gmail.com> - 2011-09-11 09:37 -0700
    Re: Java thread Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 16:56 -0400
  Re: Java thread Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 09:34 -0400
  Re: Java thread Roedy Green <see_website@mindprod.com.invalid> - 2011-09-11 08:32 -0700

csiph-web