diff --git a/src/sequencer/Version b/src/sequencer/Version index 10c088013..de28578af 100755 --- a/src/sequencer/Version +++ b/src/sequencer/Version @@ -1 +1 @@ -1.7.4 +1.7.6 diff --git a/src/sequencer/seq_main.c b/src/sequencer/seq_main.c index 0dab46979..3f92649a6 100644 --- a/src/sequencer/seq_main.c +++ b/src/sequencer/seq_main.c @@ -21,8 +21,6 @@ #include "seq.h" -#define ANSI - #ifdef ANSI /* ANSI functional prototypes */ LOCAL SPROG *alloc_task_area(SPROG *); @@ -377,6 +375,11 @@ int nChar; return NULL; } /* Initialize logging */ +/****#define GLOBAL_LOCK****/ +#ifdef GLOBAL_LOCK +SEM_ID seq_log_sem = NULL; +#endif + LOCAL VOID seq_logInit(sp_ptr) SPROG *sp_ptr; { @@ -384,8 +387,12 @@ SPROG *sp_ptr; int fd; /* Create a logging resource locking semaphore */ +#ifdef GLOBAL_LOCK + if (seq_log_sem == NULL) + seq_log_sem = semMCreate(SEM_INVERSION_SAFE | SEM_DELETE_SAFE); +#else sp_ptr->logSemId = semMCreate(SEM_INVERSION_SAFE | SEM_DELETE_SAFE); - +#endif sp_ptr->logFd = ioGlobalStdGet(1); /* default fd is std out */ /* Check for logfile spec. */ @@ -420,15 +427,22 @@ int arg1, arg2, arg3, arg4, arg5, arg6; /* arguments */ timeBfr[17] = 0; /* Lock seq_log resource */ +#ifdef GLOBAL_LOCK + semTake(seq_log_sem, WAIT_FOREVER); +#else semTake(sp_ptr->logSemId, WAIT_FOREVER); - +#endif /* Print the message: e.g. "10:23:28 T13: ...." */ fd = sp_ptr->logFd; fdprintf(fd, "%s %s: ", taskName(taskIdSelf()), &timeBfr[9]); fdprintf(fd, fmt, arg1, arg2, arg3, arg4, arg5, arg6); /* Unlock the resource */ +#ifdef GLOBAL_LOCK + semGive(seq_log_sem); +#else semGive(sp_ptr->logSemId); +#endif /* If NSF file then flush the buffer */ if (fd != ioGlobalStdGet(1) ) @@ -445,7 +459,7 @@ int arg1, arg2, arg3, arg4, arg5, arg6; /* arguments */ { extern SPROG *seq_task_ptr; - if (seq_task_ptr == ERROR) + if (seq_task_ptr == (SPROG *)ERROR) return; seq_log(seq_task_ptr, fmt, arg1, arg2, arg3, arg4, arg5, arg6); } diff --git a/src/sequencer/seq_qry.c b/src/sequencer/seq_qry.c index 1288f61d7..121af2181 100644 --- a/src/sequencer/seq_qry.c +++ b/src/sequencer/seq_qry.c @@ -15,7 +15,6 @@ #include "seq.h" -#define ANSI #ifdef ANSI int seqShow(int); int seqChanShow(int); diff --git a/src/sequencer/seq_task.c b/src/sequencer/seq_task.c index a6e7b1a41..400ee94ce 100644 --- a/src/sequencer/seq_task.c +++ b/src/sequencer/seq_task.c @@ -13,7 +13,6 @@ #include "seq.h" /* Function declarations */ -#define ANSI #ifdef ANSI LOCAL VOID ss_task_init(SPROG *, SSCB *); LOCAL long get_timeout(SSCB *); @@ -267,6 +266,7 @@ TCBX *pTcbX; /* ptr to TCB of task to be deleted */ val = taskVarGet(tid, &seq_task_ptr); if (val == ERROR) return 0; /* not one of our tasks */ + sp_ptr = (SPROG *)val; logMsg("Delete %s: sp_ptr=%d=0x%x, tid=%d\n", sp_ptr->name, sp_ptr, sp_ptr, tid); @@ -286,7 +286,6 @@ TCBX *pTcbX; /* ptr to TCB of task to be deleted */ if ( (tid_ss > 0) && (tid != tid_ss) ) { logMsg(" suspend ss task: tid=%d\n", tid_ss); - taskVarSet(tid_ss, &seq_task_ptr, ERROR); taskSuspend(tid_ss); } } @@ -321,9 +320,11 @@ TCBX *pTcbX; /* ptr to TCB of task to be deleted */ } } - /* Delete program-wide semaphores & free the task area */ + /* Delete program-wide semaphores */ semDelete(sp_ptr->caSemId); - semDelete(sp_ptr->logSemId); + /****semDelete(sp_ptr->logSemId);****/ + + /* Free the memory that was allocated for the task area */ logMsg("free sp_ptr->dyn_ptr=0x%x\n", sp_ptr->dyn_ptr); taskDelay(5); free(sp_ptr->dyn_ptr);