CVS: sml/src/runtime/config gen-offsets.c,1.4,1.5 gen-unix-signals.c,1.3,1.4 gen-unix-signals.h,1.2,1.3 gen-unix-sigtbl.c,1.3,1.4 unix-signals.c,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/config
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30184/config
Modified Files:
gen-offsets.c gen-unix-signals.c gen-unix-signals.h
gen-unix-sigtbl.c unix-signals.c
Log Message:
New scheme for managing signals in the runtime system that should avoid
race conditions (thanks to Cynbe for the design).
Index: gen-offsets.c
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/config/gen-offsets.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** gen-offsets.c 20 Apr 2001 15:07:30 -0000 1.4
--- gen-offsets.c 3 May 2005 17:26:38 -0000 1.5
***************
*** 61,66 ****
PVOFFSET("HandlerPending", vp_handlerPending);
PVOFFSET("InSigHandler", vp_inSigHandler);
! PVOFFSET("NPendingSys", vp_numPendingSysSigs);
! PVOFFSET("NPending", vp_numPendingSigs);
#endif /* !BYTECODE */
--- 61,66 ----
PVOFFSET("HandlerPending", vp_handlerPending);
PVOFFSET("InSigHandler", vp_inSigHandler);
! PVOFFSET("SigsRecv", vp_totalSigCount.nReceived);
! PVOFFSET("SigsHandled", vp_totalSigCount.nHandled);
#endif /* !BYTECODE */
Index: gen-unix-signals.c
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/config/gen-unix-signals.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** gen-unix-signals.c 1 Jun 2000 18:33:49 -0000 1.3
--- gen-unix-signals.c 3 May 2005 17:26:39 -0000 1.4
***************
*** 24,37 ****
sigInfo = SortSignalTbl ();
- numSigs = sigInfo->numSysSigs+sigInfo->numRunSigs;
f = OpenFile (DST_FILE, "_SYSTEM_SIGNALS_");
fprintf (f, "#define NUM_SYSTEM_SIGS %2d\n", sigInfo->numSysSigs);
fprintf (f, "#define MAX_SYSTEM_SIG %2d /* %s */\n",
sigInfo->maxSysSig, sigInfo->sigs[sigInfo->numSysSigs-1]->sigName);
fprintf (f, "#define NUM_SIGS %2d\n", numSigs);
! fprintf (f, "#define MAX_SIG %2d /* %s */\n",
! sigInfo->sigs[numSigs-1]->sig, sigInfo->sigs[numSigs-1]->sigName);
fprintf (f, "\n");
for (i = sigInfo->numSysSigs; i < numSigs; i++) {
--- 24,40 ----
sigInfo = SortSignalTbl ();
f = OpenFile (DST_FILE, "_SYSTEM_SIGNALS_");
+ numSigs = sigInfo->numSysSigs + sigInfo->numRunSigs;
+
fprintf (f, "#define NUM_SYSTEM_SIGS %2d\n", sigInfo->numSysSigs);
+ fprintf (f, "#define MIN_SYSTEM_SIG %2d /* %s */\n",
+ sigInfo->minSysSig, sigInfo->sigs[0]->sigName);
fprintf (f, "#define MAX_SYSTEM_SIG %2d /* %s */\n",
sigInfo->maxSysSig, sigInfo->sigs[sigInfo->numSysSigs-1]->sigName);
fprintf (f, "#define NUM_SIGS %2d\n", numSigs);
! fprintf (f, "#define SIGMAP_SZ %2d\n",
! sigInfo->maxSysSig + sigInfo->numRunSigs + 1);
fprintf (f, "\n");
for (i = sigInfo->numSysSigs; i < numSigs; i++) {
***************
*** 40,43 ****
--- 43,47 ----
}
fprintf (f, "\n");
+
fprintf (f, "#define IS_SYSTEM_SIG(S) ((S) <= MAX_SYSTEM_SIG)\n");
Index: gen-unix-signals.h
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/config/gen-unix-signals.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gen-unix-signals.h 1 Jun 2000 18:33:49 -0000 1.2
--- gen-unix-signals.h 3 May 2005 17:26:39 -0000 1.3
***************
*** 14,18 ****
sig_desc_t **sigs; /* an ordered vector of signal descriptions */
int numSysSigs; /* the number of system signals */
! int numRunSigs; /* the number of run-time signals. */
int maxSysSig; /* the maximum system signal number. */
} sig_info_t;
--- 14,19 ----
sig_desc_t **sigs; /* an ordered vector of signal descriptions */
int numSysSigs; /* the number of system signals */
! int numRunSigs; /* the number of runtime signals */
! int minSysSig; /* the minimum system signal number. */
int maxSysSig; /* the maximum system signal number. */
} sig_info_t;
Index: gen-unix-sigtbl.c
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/config/gen-unix-sigtbl.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** gen-unix-sigtbl.c 1 Jun 2000 18:33:49 -0000 1.3
--- gen-unix-sigtbl.c 3 May 2005 17:26:39 -0000 1.4
***************
*** 23,27 ****
sigInfo = SortSignalTbl ();
! numSigs = sigInfo->numSysSigs+sigInfo->numRunSigs;
f = OpenFile (DST_FILE, NIL(char *));
--- 23,27 ----
sigInfo = SortSignalTbl ();
! numSigs = sigInfo->numSysSigs + sigInfo->numRunSigs;
f = OpenFile (DST_FILE, NIL(char *));
***************
*** 35,40 ****
fprintf (f, " /* Run-time signals */\n");
for (i = sigInfo->numSysSigs; i < numSigs; i++) {
! fprintf(f, " { %s, \"%s\" },\n",
! sigInfo->sigs[i]->sigName, sigInfo->sigs[i]->shortName);
}
fprintf (f, "};\n");
--- 35,40 ----
fprintf (f, " /* Run-time signals */\n");
for (i = sigInfo->numSysSigs; i < numSigs; i++) {
! fprintf(f, " { %s, \"%s\" },\n",
! sigInfo->sigs[i]->sigName, sigInfo->sigs[i]->shortName);
}
fprintf (f, "};\n");
Index: unix-signals.c
===================================================================
RCS file: /cvsroot/smlnj/sml/src/runtime/config/unix-signals.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** unix-signals.c 1 Jun 2000 18:33:49 -0000 1.3
--- unix-signals.c 3 May 2005 17:26:39 -0000 1.4
***************
*** 70,79 ****
#define TABLE_SIZE (sizeof(SigTable)/sizeof(sig_desc_t))
-
/* the run-time system generated signals */
! sig_desc_t RunTSignals[] = {
! { -1, "RUNSIG_GC", "GC" },
};
! #define NUM_RUN_SIGS (sizeof(RunTSignals)/sizeof(sig_desc_t))
/* SortSignalTbl:
--- 70,78 ----
#define TABLE_SIZE (sizeof(SigTable)/sizeof(sig_desc_t))
/* the run-time system generated signals */
! sig_desc_t RunTSignals[] = {
! { -1, "RUNSIG_GC", "GC" },
};
! #define NUM_RUN_SIGS (sizeof(RunTSignals)/sizeof(sig_desc_t))
/* SortSignalTbl:
***************
*** 85,89 ****
sig_info_t *sigInfo;
! signals = NEW_VEC(sig_desc_t *, TABLE_SIZE+NUM_RUN_SIGS);
/* sort the signal table by increaseing signal number; the sort removes
--- 84,88 ----
sig_info_t *sigInfo;
! signals = NEW_VEC(sig_desc_t *, TABLE_SIZE + NUM_RUN_SIGS);
/* sort the signal table by increaseing signal number; the sort removes
***************
*** 116,127 ****
/* add the run-time system signals to the table */
for (i = 0, j = n; i < NUM_RUN_SIGS; i++, j++) {
! signals[j] = &(RunTSignals[i]);
! signals[j]->sig = signals[n-1]->sig+i+1;
}
sigInfo = NEW_OBJ(sig_info_t);
sigInfo->sigs = signals;
sigInfo->numSysSigs = n;
sigInfo->numRunSigs = NUM_RUN_SIGS;
sigInfo->maxSysSig = signals[n-1]->sig;
--- 115,128 ----
/* add the run-time system signals to the table */
for (i = 0, j = n; i < NUM_RUN_SIGS; i++, j++) {
! signals[j] = &(RunTSignals[i]);
! signals[j]->sig = signals[n-1]->sig+i+1;
}
+
sigInfo = NEW_OBJ(sig_info_t);
sigInfo->sigs = signals;
sigInfo->numSysSigs = n;
sigInfo->numRunSigs = NUM_RUN_SIGS;
+ sigInfo->minSysSig = signals[0]->sig;
sigInfo->maxSysSig = signals[n-1]->sig;
-------------------------------------------------------
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