Make thread Yield and sleep at the same time

Discussion in 'Java' started by Rick, Oct 4, 2003.

  1. Rick

    Rick Guest

    Hi,

    I need to make a thread sleep for 10 seconds.. but I want to yield() it
    so that it loses ownership between those 10 secs and lets other threads
    do their job. How can i do this? How can i make the thread let other
    threads work while sleep as well? Thanks

    Rick
     
    Rick, Oct 4, 2003
    #1
    1. Advertising

  2. Rick

    VisionSet Guest

    "Rick" <rrquick@nospam-com> wrote in message
    news:3f7f17c2$...
    > Hi,
    >
    > I need to make a thread sleep for 10 seconds.. but I want to yield() it
    > so that it loses ownership between those 10 secs and lets other threads
    > do their job. How can i do this? How can i make the thread let other
    > threads work while sleep as well? Thanks


    No need for yield()
    A sleeping thread steps out of the running state, so any thread in the ready
    state is eligible to be run. ie generally if you have started 2 threads
    running. If one sleeps the other will continue.

    --
    Mike W
     
    VisionSet, Oct 4, 2003
    #2
    1. Advertising

  3. Rick

    Roedy Green Guest

    On Sun, 05 Oct 2003 05:06:56 +1000, Rick <rrquick@nospam-com> wrote or
    quoted :

    >I need to make a thread sleep for 10 seconds.. but I want to yield() it
    >so that it loses ownership between those 10 secs and lets other threads
    >do their job. How can i do this? How can i make the thread let other
    >threads work while sleep as well? Thanks


    See http://mindprod.com/jgloss/sleep.html

    see also http://mindprod.com/jgloss/thread.html and links.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Oct 4, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gonzalo Moreno
    Replies:
    2
    Views:
    12,563
  2. Replies:
    1
    Views:
    341
    Gabriel Genellina
    Apr 22, 2008
  3. Dmitry Teslenko
    Replies:
    0
    Views:
    657
    Dmitry Teslenko
    Jan 3, 2010
  4. Markus
    Replies:
    1
    Views:
    217
    Mark Hubbart
    Sep 27, 2004
  5. Michael Edgar
    Replies:
    13
    Views:
    303
    Brian Candler
    Apr 21, 2011
Loading...

Share This Page