Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C++ Libraries / September 2003

Tip: Looking for answers? Try searching our database.

Afx Thread sleep?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michelle - 26 Sep 2003 10:19 GMT
Hi,

I have created a thread as shown below:
    myThread = AfxBeginThread(MyThreadProc, myCheck);

But I'm trying to have this thread ("myThread") yield somehow. Is
there a sleep() or yield() method that we can call specifically on an
AfxThread? If anyone has any clue how to make my newly created thread
yield to the overall thread, please email shellszie1@hotmail.com

Thank you,
Michelle
Mihajlo Cvetanovic - 29 Sep 2003 09:14 GMT
> I have created a thread as shown below:
>      myThread = AfxBeginThread(MyThreadProc, myCheck);
[quoted text clipped - 3 lines]
> AfxThread? If anyone has any clue how to make my newly created thread
> yield to the overall thread, please email shellszie1@hotmail.com

It would be much more efficient if you could tell us what you want
from the thread. Different goals "yields" different solutions. There
is no yield() anymore since Win is pre-emptive OS now (it controls the
execution of all threads). There is Sleep(), but it may not be the
solution for your problem, though it may seem to work in some cases.

There is an option while creating the thread to create it in suspended
state, so you could do something with it, and then call ResumeThread,
and there are synchronization mechanisms (critical sections, mutexes,
events) to make threads wait for each other.

HTH

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.