CVS: sml-dist/src/runtime/mach-dep cygwin-fault.c,1.1,1.2

Allen Leung <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj.commits
Message-ID <[email protected]>
Update of /cvsroot/smlnj/sml-dist/src/runtime/mach-dep
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29733/src/runtime/mach-dep

Modified Files:
	cygwin-fault.c 
Log Message:
     Updated cygwin's signal/fault handling to match window's code.


Index: cygwin-fault.c
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/runtime/mach-dep/cygwin-fault.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** cygwin-fault.c	16 May 2003 16:59:31 -0000	1.1
--- cygwin-fault.c	31 May 2005 20:47:40 -0000	1.2
***************
*** 23,26 ****
--- 23,48 ----
  #define SELF_VPROC      (VProc[0])
  
+ /* generic handler for cygwin "signals" such as interrupt, alarm */
+ /* returns TRUE if the main thread is running ML code */
+ BOOL cygwin_generic_handler(int code)
+ {
+    vproc_state_t   *vsp = SELF_VPROC;
+ 
+    vsp->vp_sigCounts[code].nReceived++;
+    vsp->vp_totalSigCount.nReceived++;
+ 
+    vsp->vp_limitPtrMask = 0;
+ 
+    if (vsp->vp_inMLFlag &&
+       (! vsp->vp_handlerPending) &&
+       (! vsp->vp_inSigHandler))
+    {
+       vsp->vp_handlerPending = TRUE;
+       SIG_ZeroLimitPtr();
+       return TRUE;
+    }
+    return FALSE;
+ }
+ 
  PVT BOOL __stdcall ctrl_c_handler(DWORD type)
  {
***************
*** 29,45 ****
        case CTRL_C_EVENT:
        case CTRL_BREAK_EVENT:
!       {  vproc_state_t * vsp = SELF_VPROC;
!          EnqueueSignal(vsp, SIGINT);
!          vsp->vp_numPendingSysSigs++;
!          if (vsp->vp_inMLFlag && 
!                (! vsp->vp_handlerPending) && 
!                (! vsp->vp_inSigHandler))
!          {
!             vsp->vp_handlerPending = TRUE;
!             SIG_ZeroLimitPtr(NULL);
              return TRUE;
           }
           return FALSE;
-       }  break;
        default: ;
           return FALSE;
--- 51,58 ----
        case CTRL_C_EVENT:
        case CTRL_BREAK_EVENT:
!          if (!cygwin_generic_handler(SIGINT)) {
              return TRUE;
           }
           return FALSE;
        default: ;
           return FALSE;
***************
*** 59,63 ****
  
  /*
!  * This filter is catches all exceptions. 
   */
  PVT int page_fault_handler
--- 72,76 ----
  
  /*
!  * This filter catches all exceptions. 
   */
  PVT int page_fault_handler



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.