Re: Help with Thread Sleep Calls causing lack of SLEEP
From: Jon Skeet (skeet_at_pobox.com)
Date: 11/19/03
- Next message: J P: "Re: Serialization"
- Previous message: FISH: "Re: thread"
- In reply to: Alex Hunsley: "Re: Help with Thread Sleep Calls causing lack of SLEEP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 19 Nov 2003 13:07:47 -0000
Alex Hunsley <lard@tardis.ed.ac.molar.uk> wrote:
> Are you sure you don't mean Thread.currentThread().sleep(3000)?
He certainly doesn't. sleep() is a static method. It's unfortunate that
Java allows static members to be accessed via references, but the above
does nothing different from Thread.sleep() - the current thread is
*always* the one which is set to sleep.
> Anyway, it sounds like you're using sleep for an evil purpose - i.e.
> waiting a random set amount of time for something else to finish - you
> should probably be using monitors or locking or something similar in
> this case.
Agreed.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: J P: "Re: Serialization"
- Previous message: FISH: "Re: thread"
- In reply to: Alex Hunsley: "Re: Help with Thread Sleep Calls causing lack of SLEEP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|