Make thread Yield and sleep at the same time

R

Rick

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
 
V

VisionSet

Rick said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top