troubleshooting Question

afxbeginthread - starting and stopping

Avatar of ol muser
ol muserFlag for United States of America asked on
Visual C++.NET
1 Comment1 Solution583 ViewsLast Modified:
I have a multithreading application in which I start a worker thread using AfxBeginThread to get a count( X). The thread runs a stored proc to get the count and display in the application. Right now the thread automatically ends when the controlling function ends. X might change during the life of the application and so I would like to keep the thread running in the backgroud, run the stored proc at regular intervals, say, every, 5 min so I could update the count display.  What is the best practice regarding this (I am considering using a sleeper function that wakes up every 5 min) and how do I gracefully shutdown the thread when the application goes down? Or does the worker thread automatically go down if the app is shutting down. Pls respond with actual function calls you may use.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros