www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/09/24/04:14:14

From: jeffdbREMOVETHIS AT netzone DOT com (Mikey)
Subject: Cygwin32 Signals
24 Sep 1997 04:14:14 -0700 :
Message-ID: <3428d6ab.66183629.cygnus.gnu-win32@smtp.netzone.com>
Reply-To: jeffdbREMOVETHIS AT netzone DOT com
Mime-Version: 1.0
To: sos AT prospect DOT com DOT ru, gnu-win32 AT cygnus DOT com

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 ;^).

(jeffdbREMOVETHIS AT netzone DOT com)
delete REMOVETHIS from the above to reply
         Mikey
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019