Hi,
I'd like to state more clear about my problem:
(single thread application)
main(){
start com port listener
if(event occur)
println("hello")
println("before sleep")
Thread.sleep(10000) //slepp 10 seconds
println("after sleep")
}
how can the "hello" be printed if the serial port event occurred during the
10 seconds sleeping time?
Thanks All...hope can help
Steven
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "JDJList" <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 9:27 AM
Subject: [jdjlist] Re: Thread.sleep problem...Please help
> You can always spawn off a second thread from your main thread. One way
to
> do this is to have your application's class implement the Runnable
> interface, then from your main thread issue:
>
> Thread t = new Thread(this);
> t.start();
>
> This will start your second thread running in Runnable's public void run()
> method which you'd need to implement.
>
> -----Original Message-----
> From: Steven [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 6:10 PM
> To: JDJList
> Subject: [jdjlist] Re: Thread.sleep problem...Please help
>
>
> Hi,
>
> Thanks for ur opinion. But what if my application has only single thread?
> are there any alternatives?
>
> ----- Original Message -----
> From: "Hema Venkataraman" <[EMAIL PROTECTED]>
> To: "JDJList" <[EMAIL PROTECTED]>
> Sent: Friday, April 05, 2002 12:42 PM
> Subject: [jdjlist] Re: Thread.sleep problem...Please help
>
>
> > You have a thread for a COM port which will be listening for events. You
> > have another Thread to do the actions to be done. Make them sleep for
few
> > seconds. You can also use wait and notify in case actions are to be
taken
> > when a particular event happens.
> >
> >
> >
> >
> > To change your membership options, refer to:
> > http://www.sys-con.com/java/list.cfm
>
>
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm
>
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm