Skip to content

Commit

Permalink
Introduce PROCESSINFO_TRIGGERMODE_SEMAPHORE_PROP_TIMEOUTS and make it…
Browse files Browse the repository at this point in the history
… default for milk-streamFITSlog.
  • Loading branch information
scexao5 committed Dec 5, 2024
1 parent 3a260ff commit 3ce11b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/COREMOD_memory/scripts/milk-streamFITSlog
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ milk << EOF
readshmim ${STREAMNAME}
streamFITSlog ..procinfo 1
streamFITSlog ..loopcntMax -1
streamFITSlog ..triggermode 3
streamFITSlog ..triggermode 5
streamFITSlog ..triggersname ${STREAMNAME}
streamFITSlog ..triggertimeout ${cubetimeout}
streamFITSlog ..RTprio ${realtimeprio}
Expand Down
21 changes: 6 additions & 15 deletions src/CommandLineInterface/CLIcore/CLIcore_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,12 @@ typedef struct
processloopOK = processinfo_loopstep(processinfo); \
DEBUG_TRACEPOINT("waitoninputstream"); \
processinfo_waitoninputstream(processinfo); \
if (processinfo->triggerstatus != PROCESSINFO_TRIGGERSTATUS_RECEIVED) \
if (processinfo->triggerstatus == PROCESSINFO_TRIGGERSTATUS_TIMEDOUT && \
processinfo->triggermode == PROCESSINFO_TRIGGERMODE_SEMAPHORE) \
{ \
/* Don't execute loop at all upon semaphore timeout */ \
/* Except if the trigger is SEMAPHORE_PROP_TIMEOUTS */ \
/* in which case we avoid this block and keep going */ \
continue; \
} \
DEBUG_TRACEPOINT("exec_start"); \
Expand Down Expand Up @@ -938,24 +941,12 @@ static inline imageID resolveIMGID(
{
if((ERRMODE == ERRMODE_FAIL) || (ERRMODE == ERRMODE_ABORT))
{
printf("ERROR: %c[%d;%dm Cannot resolve image %s %c[%d;m\n",
(char) 27,
1,
31,
img->name,
(char) 27,
0);
PRINT_ERROR("Cannot resolve image %s\n", img->name);
abort();
}
else if(ERRMODE == ERRMODE_WARN)
{
printf("WARNING: %c[%d;%dm Cannot resolve image %s %c[%d;m\n",
(char) 27,
1,
35,
img->name,
(char) 27,
0);
PRINT_WARNING("Cannot resolve image %s\n", img->name);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/CommandLineInterface/processtools_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ errno_t processinfo_waitoninputstream(PROCESSINFO *processinfo)
return RETURN_SUCCESS;
}

if(processinfo->triggermode == PROCESSINFO_TRIGGERMODE_SEMAPHORE)
if(processinfo->triggermode == PROCESSINFO_TRIGGERMODE_SEMAPHORE ||
processinfo->triggermode == PROCESSINFO_TRIGGERMODE_SEMAPHORE_PROP_TIMEOUTS)
{
int semr;
int tmpstatus = PROCESSINFO_TRIGGERSTATUS_RECEIVED;
Expand Down
6 changes: 5 additions & 1 deletion src/CommandLineInterface/processtools_trigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
// trigger after a time delay
#define PROCESSINFO_TRIGGERMODE_DELAY 4

// trigger when semaphore is posted AND propagate the timeout (i.e. enter the execution anyway)
#define PROCESSINFO_TRIGGERMODE_SEMAPHORE_PROP_TIMEOUTS 5

// trigger is currently waiting for input
#define PROCESSINFO_TRIGGERSTATUS_WAITING 1

// trigger has been received and we're executing the loop
#define PROCESSINFO_TRIGGERSTATUS_RECEIVED 2
// trigger has not been received but we've skipped out of the wait into the execution of the loop
#define PROCESSINFO_TRIGGERSTATUS_TIMEDOUT 3

#include "CLIcore.h"
Expand Down

0 comments on commit 3ce11b1

Please sign in to comment.