Thread: Re: Win32 signal code - first try

Re: Win32 signal code - first try

From
"Merlin Moncure"
Date:
> Here is a first sketch at Win32 signal handling. First a couple of
> comments:

Couple of quick questions/points regarding your implementation:

1. Fully support your decision to use named pipes.

2.  __pg_signal_count is guarded by a CriticalSection.  Are
Interlocked{Exchange / Increment} still necessary?

3. you are absolutely certain that
__pg_poll_signals() +
EnterCriticalSection +
memset +
if... +
LeaveCriticalSection +
if...

is more efficient than a single call to WaitForSingleObjectEx() with 0
timeout?

> * Uses named pipes. Shared mem was slightly faster, named pipes a lot
> cleaner. And the signal handlers themselves should not be performance
> critical, AFAICS.

Right...only the 'poll' function is truly critical

> * Does *not* use user APCs. Why? Well, we had to use polling. And with
> user APCs we'd have to go into kernel mode (however briefly) on every
> poll. I replaced that with a simple counter that is checked. Thast way
> we don't slow down the main path of the program much.

Have you have given up on using a kernel mode driver to throw a thread
into alertable state?

Merlin