<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
I noticed in some of the code..I think for SegV, Quit,<BR>etc., not for thread suspension, that if the signal<BR>is already set to other than SIG_DFL, Modula-3 refrains<BR>from changing it.<BR>
<BR>
So, I was thinking, would it be reasonable to iterate through, say<BR>SIGUSR1, SIGUSR2, and SIGRTMIN through SIGRTMAX, and<BR>use the "first" one that isn't set to SIG_DFL?<BR>By "first", I don't mean to imply what order to check in,<BR>probably my statement has the order backwards.<BR>The point is to check them and not just hijack them.<BR>
<BR>
OR, is there another way to do this?<BR>
<BR>Doesn't or can't the Modula-3 code "check a flag"<BR>"every so often" and then voluntarily yield?<BR>Of course, the allocator would check the flag.<BR>
<BR>Perhaps I just really need to get "that paper" into my head?<BR>Understand the issue around "other threads running in<BR>tight computation loops for a long time", and therefore not checking<BR>on yielding?<BR>
<BR>Is the signal mechanism actually preemptive anyway?<BR>
<BR> - Jay<BR><BR><BR><BR><BR><BR><BR>> From: hosking@cs.purdue.edu<BR>> To: jay.krell@cornell.edu<BR>> Date: Wed, 21 Jan 2009 09:42:38 -0500<BR>> CC: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] chosing SIG_SUSPEND?<BR>> <BR>> Yes, we want a signal no-one else is using to stop the threads.<BR>> <BR>> On 21 Jan 2009, at 08:37, Jay wrote:<BR>> <BR>> ><BR>> > Solaris at least currently has SIGRTMAX.<BR>> > I want to switch RTSignalC.c to "something" here.<BR>> > I can preserve compat, like<BR>> ><BR>> > #ifdef __sun<BR>> > SIGUSR2<BR>> > #else..<BR>> ><BR>> > or..?<BR>> ><BR>> > I could do<BR>> > #ifdef SIGUSR2<BR>> > #define SIG_SUSPEND SIGUSR2<BR>> > #elif defined(SIGRTMAX)<BR>> > #define SIG_SUSPEND SIGRTMAX<BR>> > #else<BR>> > #error<BR>> > #endif<BR>> ><BR>> > I'll go with a compatible version for now and you can change it if <BR>> > you want.<BR>> > I'll test on Linux/x86, FreeBSD (AMD64, but hopefully there is gcc - <BR>> > m32),<BR>> > Linux/PPC, Solaris, Cygwin, Darwin/PPC (uh, actually, no, Darwin isn't<BR>> > really relevant, but I'll make sure the result does what is intended.)<BR>> ><BR>> > It looks like SIGRTMAX is a function call on Solaris.<BR>> ><BR>> > This stuff is like broken, right?<BR>> > I mean, there's a small number of signals and there's no arbitration.<BR>> > People just take them over and hope nobody else cares.<BR>> ><BR>> ><BR>> > There's no way to just queue a function call to a thread, in <BR>> > portable/general?<BR>> > Windows has QueueUserAPC or SuspendThread (SuspendThread is dangerous,<BR>> > thread could be doing anything), QueueUserAPC only interrupts at <BR>> > certain times.<BR>> ><BR>> ><BR>> > - Jay<BR>> ><BR>> ><BR>> > ----------------------------------------<BR>> >> From: hosking@cs.purdue.edu<BR>> >> To: jay.krell@cornell.edu<BR>> >> Date: Wed, 21 Jan 2009 03:42:01 +1100<BR>> >> CC: m3devel@elegosoft.com<BR>> >> Subject: Re: [M3devel] chosing SIG_SUSPEND?<BR>> >><BR>> >> Choose SIGRTMAX first if defined, then SIGUSR2. I don't thing NSIG-1<BR>> >> is reliable, but just works on some systems.<BR>> >><BR>> >> On 21 Jan 2009, at 01:12, Jay wrote:<BR>> >><BR>> >>><BR>> >>> What is the algorithm for chosing SIG_SUSPEND?<BR>> >>><BR>> >>> Something like:<BR>> >>><BR>> >>> #include<BR>> >>><BR>> >>> #ifdef __APPLE__<BR>> >>> /* nothing -- SIG_SUSPEND not used */<BR>> >>> #elif defined(NSIG)<BR>> >>> #define SIG_SUSPEND (NSIG - 1)<BR>> >>> #elif defined(_NSIG)<BR>> >>> #define SIG_SUSPEND (_NSIG - 1)<BR>> >>> #elif defined(SIGRTMAX)<BR>> >>> #define SIG_SUSPEND SIGRTMAX<BR>> >>> #else<BR>> >>> #define SIG_SUSPEND SIGUSR2<BR>> >>> #endif<BR>> >>><BR>> >>> ?<BR>> >>><BR>> >>> Whatever it is, I think it should be in RTSignalC.c.<BR>> >>><BR>> >>> - Jay<BR>> >><BR>> <BR><BR></body>
</html>