CVS: sml/src/runtime/include ml-signals.h,1.2,1.3 vproc-state.h,1.3,1.4

John Reppy <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj.commits
Message-ID <[email protected]>
Update of /cvsroot/smlnj/sml/src/runtime/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30184/include

Modified Files:
	ml-signals.h vproc-state.h 
Log Message:
  New scheme for managing signals in the runtime system that should avoid
  race conditions (thanks to Cynbe for the design).


Index: ml-signals.h
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/include/ml-signals.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ml-signals.h	1 Jun 2000 18:33:51 -0000	1.2
--- ml-signals.h	3 May 2005 17:26:39 -0000	1.3
***************
*** 7,15 ****
  #define _ML_SIGNALS_
  
! typedef struct {		/* an item in the pending signal queue */
!     int		sigNum;		    /* the ID number of the pending signal */
!     int		count;		    /* the count of how many of this kind */
! 				    /* of signal are pending. */
! } pending_sig_t;
  
  /* The state of ML signal handlers; these definitions must agree with
--- 7,19 ----
  #define _ML_SIGNALS_
  
! typedef struct {		/* counters for pending signals; we keep two counters */
! 				/* to avoid race conditions */
!     unsigned int	nReceived;  /* the count of how many signals of this variety */
! 				    /* have been received. This counter is incremented */
! 				    /* the signal handler */
!     unsigned int	nHandled;  /* the count of how many of this kind of */
! 				    /* signal have been handled.  This counter */
! 				    /* is incremented by the main thread. */
! } sig_count_t;
  
  /* The state of ML signal handlers; these definitions must agree with
***************
*** 22,30 ****
  /** Utility functions **/
  extern void ChooseSignal (vproc_state_t *vsp);
- extern void EnqueueSignal (vproc_state_t *vsp, int sigCode);
  extern ml_val_t MakeResumeCont (ml_state_t *msp, ml_val_t resume[]);
  extern ml_val_t MakeHandlerArg (ml_state_t *msp, ml_val_t resume[]);
  extern void LoadResumeState (ml_state_t *msp);
- extern bool_t GCSignal (vproc_state_t *vsp);
  
  /* OS dependent implementations of signal operations. */
--- 26,32 ----

Index: vproc-state.h
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/include/vproc-state.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** vproc-state.h	20 Apr 2001 15:07:30 -0000	1.3
--- vproc-state.h	3 May 2005 17:26:40 -0000	1.4
***************
*** 41,54 ****
      bool_t	vp_handlerPending;	/* Is there a signal handler pending? */
      bool_t	vp_inSigHandler;	/* Is an ML signal handler active? */
!     int		vp_numPendingSysSigs;	/* number of pending system signals */
!     int		vp_numPendingSigs;	/* number of pending runtime system */
! 					/* signals */
      int		vp_sigCode;		/* the code and count of the next */
      int		vp_sigCount;		/* signal to handle. */
!     pending_sig_t vp_pendingSigQ[NUM_SIGS]; /* the queue of pending signals. */
!     int		vp_nextPendingSig;	/* the index in the queue of the next */
  					/* signal to handle. */
-     int		vp_numInQ;		/* the number of pending signals in */
- 					/* the queue. */
      int		vp_gcSigState;		/* The state of the GC signal handler */
      Time_t	*vp_gcTime0;	    /* The cumulative CPU time at the start of */
--- 41,50 ----
      bool_t	vp_handlerPending;	/* Is there a signal handler pending? */
      bool_t	vp_inSigHandler;	/* Is an ML signal handler active? */
!     sig_count_t	vp_totalSigCount;	/* summary count for all system signals */
      int		vp_sigCode;		/* the code and count of the next */
      int		vp_sigCount;		/* signal to handle. */
!     sig_count_t	vp_sigCounts[SIGMAP_SZ]; /* counts of signals. */
!     int		vp_nextPendingSig;	/* the index in sigCounts of the next */
  					/* signal to handle. */
      int		vp_gcSigState;		/* The state of the GC signal handler */
      Time_t	*vp_gcTime0;	    /* The cumulative CPU time at the start of */



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
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.