Subject: Cygwin32 Signals
From: [email-masked] (Mikey)

24 Sep 1997 04:14:14 -0700
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked], [email-masked]

Perhaps you misunderstood.

My point was that in order for
signal handling to work at all consistently on win95
the microsoft restrictions, on signal
handling functions need to be followed.
(I realize you can't do anything about user 
software that installs its own handlers ;^)
But doing low level IO in the handler functions
as all of the default signal handlers
in cygwin.dll have to do, can't be allowed, or
you will get random crashes.

I don't want to do any serious work on this right now,
because I don't have access to current sources,
and it would just have to be redone when B19
comes out.

perhaps the following Psuedocode fragment will
give you some workable ideas.

init_signals
{

struct
{
HANDLE signals[NSIG];
void * functions[NSIG];
}sig_ptrs;

char lpName[MAX_PATH];
int i;

CreateThread()

for (i=0;i<=NSIG;i++)
{
sprintf(lpName, "%s.%s\0", pid, i)
HANDLE = CreateEvent( NULL, FALSE, FALSE, &lpName); 
sig_ptrs.signals[i] = HANDLE;
sig_prts.functions[i] = &handle_dfn
}

( install ^C & other here)

Reset_sig:

NewHandle = WaitForMultipleObjects(....)

for (i=0;i<=NSIG;i++)
{
if( sig_ptrs.signals[i] == NewHandle;
	sig_prts.functions[i]();
}
goto Reset_Sig;
}

Kill( pid, sig)
{
char signame[MAX_PATH];
sprintf(signame, "%s.%s\0", pid, sig)
SIG_HANDLE = OpenEvent( EVENT_MODIFY_STATE, FALSE, &signame);
SetEvent(SIG_HANDLE);
}

This would avoid the IO associated with the "invisible window",
and windows messaging, 

You could also use mapped memory, if you prefer a faster
solution (I don't know anything about how you would go about
that, just that it's another form of IPC), Possibly you have
considered this type of solution, and eliminated it for 
some reason unknown to me,

but there's more than 1 way to skin a cat ;^).

([email-masked])
delete REMOVETHIS from the above to reply
         Mikey
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".