Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Dec : Sleeping infinitely
| Subject: | Sleeping infinitely |
| Posted by: | "Rob Kennedy" (m..@privacy.net) |
| Date: | Wed, 27 Dec 2006 23:53:54 |
I was reading the documentation for the Sleep API function today and
noticed that it makes special mention of passing Infinite as the sleep
duration:
"A value of INFINITE indicates that the suspension should not time out."
So, if the suspension doesn't time out, how _does_ the thread resume
running?
I can see reasons for infinite waiting in some of the other
thread-suspension functions, such as WaitForSingleObject or SleepEx. In
those functions, there are other situations built into the functions
that will cause them to return. But can Sleep(Infinite) ever return? Can
the sleeping thread be signaled from some other thread to make it resume
running, either by making Sleep return, or by causing an exception to
send execution somewhere else?
If it can't, then is there any reason to call it? Wouldn't it be easier
to simply terminate the thread?
--
Rob