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


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

Re: Java thread

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Java thread
Date 2011-09-10 21:34 -0700
Organization A noiseless patient Spider
Message-ID <j4hdpg$ggd$1@dont-email.me> (permalink)
References <128ea2e0-7a2e-4c86-9507-8e15a0b892b9@p25g2000pri.googlegroups.com>

Show all headers | View raw


On 9/10/2011 9:03 PM, Jack wrote:
> For Java thread, how to ensure that wait() does not miss notify()?
> Otherwise the thread will hang and can not shut down.


You can't.  The timing involved can always be such that notify is called 
when the thread is not waiting.

I believe you're using the wrong mechanism if you're worried about 
thread shutdown.  Look into Thread.interrupt() instead.

<http://download.oracle.com/javase/tutorial/essential/concurrency/interrupt.html>


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


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