httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Hyde <>
Subject Re: Signalling an NT process.
Date Sun, 11 Jan 1998 20:23:00 GMT
Paul Sutton <> wrote:
>On Sat, 10 Jan 1998, Ben Hyde wrote:
>> This is all too weird.  ...
>You mean a signal() type signal? I don't think those are really very well
>implemented in NT. MS seem to provide no way of doing an async interrupt. 
>You have to poll or use a wait-on-an-event style to simulate interrupts. 

Yeah, that's my impression too.  How
is one expected to gain control over an out of control thread? 
Putting a polling device into unblock_alarms - best I can see - but not
actually effective when the out of control is due to - oh say a cgi

>> So I'd propose having unblock_alarms poll to see if it should simulate
>> a signal.  Then let "apache-signal" awaken the process from it's
>> slumber,
>> and finally use CreateRemoteThread, to fire a slightly higher priority
>> thread inside the process that sets the globals that the signal
>> simulation
>> uses, or takes drastic action when that's required.     Bogus, you bet.
>I'm sorry, I don't really understand what you mean. 

my fault, didn't recall you'd already talked about using a family of
events to pass in the signals.

> Are you trying to
>implement a way of signalling a shutdown/restart? 

I was focused on the how to get the attention of an out of control
thread, short of killing it.  If the thread is holding a lock I'd
very much like to let it unwind it's stack, and clean up.

>If so, I've already
>described a way of doing that using a new thread in the parent process
>(the main thread sits in an infinite wait for "apache-signal", which can
>be used to wakeup this thread. All we have to figure out is how to signal
>the second thread from a separate process. That could be by another event
>for each type of signal). 

I think we're thinking the same things, with the minor detail that I was
presuming that createRemoteThread would be used to pass the "type of signal"
In my fantasy code we add a switch to Apache (letting it fill the role
of the unix kill command) to kick the main process.

   apache --kick_server reload_configuration

would fire up a short lived process, that looked up the pid of the
server and used CreateRemoteThread to inject a high priority thread
plus some data into the server and exit.  That high priority thead
would then do it's best to get the attention of the server's more
typical threads using various methods to persuade them depending on
the seriousness of it's mission.

The approach your outlining, i.e. use a family of named events to awaken
a preexisting thread in the server, is just as good.  I don't think
you've mentioned that this thread needs a slight priority boost to
assure it awakens next time the OS considers scheduling.

 - ben hyde

View raw message