From: <ol...@in...> - 2002-01-29 00:37:37
|
On 28 Jan 2002 13:27:46 -0500, Todd Sabin <ts...@op...> wrote: >Sam Steingold <sd...@gn...> writes: > >> when you start CLISP under win32 (or, rather, when _I_ start the = current >> CVS CLISP under nt4sp6 :-) and hit C-c, CLISP dies (as it should), but >> issues an error message: >>=20 >> *** - Win32 error 87 (ERROR_INVALID_PARAMETER): The parameter is = incorrect. >> [...] > >Like the other poster, I don't see this with current CVS on nt4sp6 or >win2k. > >> can a win32 guru explain this to me (or, better yet, earn eternal fame >> by winning a mention in the CLISP ChangeLog by submitting a patch :-) >> (note that interruptible_thread at that moment does contain a thread >> created in DoInterruptible()) > >As the man page says, TerminateThread is a bad idea, generally. You >may be seeing odd side-effects of using it. If used enough, it will >eventually ruin your day. The safe way to do what that code wants to >do is by having the main thread create an event, which it passes to >the child thread. The child thread then does WaitForMultipleObjects >on that event and the handle it wants to do IO on. If the >ControlHandler is called, it sets that event, which wakes the child >thread and lets it return gracefully (but unsuccessfully). No more >TerminateThread. > > Rather than sending Windows messages around, I prefer to create a bool valiable that the parent toggles when it wants the child to stop. The infinite loop then terminates and the function called by the thread exits, killing the thread. |