HElp needed to create a windows service , to launch a simple thread(win32)

Go4Expert Member
8Dec2009,18:58   #1
rag84dec's Avatar
HElp needed to create a windows service , to launch a simple thread created by the user.
I got an article here...

http://www.devx.com/cplus/Article/9857/1954


But how to create a thread at apropriate places , like STOP , RESUME , SHUTDOWN?.PLease
give me some pointers ,

thanks in advance...
Contributor
8Dec2009,20:15   #2
Gene Poole's Avatar
It really depends on the nature of your service. Typically a service should spend most of its time waiting for some sort of event. Your main thread should be in some sort of loop that polls for some sort of event, and if nothing is going on, it sleeps for some amount of time, then polls again. While in this loop of polling, you can check for mutexes (mutices?) or semaphores which can be set as a result of STOP, RESUME, or PAUSE with WaitForSingleEvent() or WaitForMultipleEvents() API calls.