This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Cygwin32 Signals


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@netzone.com)
delete REMOVETHIS from the above to reply
         Mikey
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]