Commit 887cc88e authored by claes's avatar claes

Handling of termination event and process status

parent 22075623
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
#include "rt_sansm.h" #include "rt_sansm.h"
#include "rt_subcm.h" #include "rt_subcm.h"
#include "rt_subsm.h" #include "rt_subsm.h"
#include "rt_aproc.h"
#include "rt_pwr_msg.h"
#include "rt_ini_event.h"
#include "rt_qcom.h"
#include "rt_qcom_msg.h"
typedef struct s_Timer sTimer; typedef struct s_Timer sTimer;
...@@ -72,6 +77,11 @@ static time_tClock last_clock; ...@@ -72,6 +77,11 @@ static time_tClock last_clock;
static int timer_flag; static int timer_flag;
#endif #endif
static void
event (
qcom_sGet *get
);
static void static void
sancAdd ( sancAdd (
sTimer *tp sTimer *tp
...@@ -202,18 +212,39 @@ main ( ...@@ -202,18 +212,39 @@ main (
char **argv char **argv
) )
{ {
pwr_tStatus sts;
time_tClock wait_clock; time_tClock wait_clock;
qcom_sQid my_q = qcom_cNQid;
qcom_sGet get;
int tmo = 0;
init(); init();
if (!qcom_CreateQ(&sts, &my_q, NULL, "events")) {
exit(sts);
}
if (!qcom_Bind(&sts, &my_q, &qcom_cQini)) {
exit(-1);
}
gdbroot->db->log.b.tmon = 0; gdbroot->db->log.b.tmon = 0;
for (wait_clock = 0;;) { for (wait_clock = 0;;) {
get.data = NULL;
qcom_Get(&sts, &my_q, &get, tmo);
if (sts != QCOM__TMO && sts != QCOM__QEMPTY) {
if (get.type.b == qcom_eBtype_event) {
event(&get);
}
qcom_Free(&sts, get.data);
}
if (wait_clock != 0) if (wait_clock != 0)
waitClock(wait_clock); waitClock(wait_clock);
aproc_TimeStamp();
now_clock = time_Clock(NULL, NULL); now_clock = time_Clock(NULL, NULL);
if (now_clock < last_clock) { if (now_clock < last_clock) {
errh_Info("The uptime clock has wrapped"); errh_Info("The uptime clock has wrapped");
...@@ -232,6 +263,23 @@ main ( ...@@ -232,6 +263,23 @@ main (
} }
} }
static void
event (
qcom_sGet *get
)
{
qcom_sEvent *ep = (qcom_sEvent*) get->data;
ini_mEvent new_event;
if (get->type.s != qcom_cIini)
return;
new_event.m = ep->mask;
if (new_event.b.terminate) {
exit(0);
}
}
/* . */ /* . */
static void static void
...@@ -757,17 +805,20 @@ init( ...@@ -757,17 +805,20 @@ init(
pwr_tStatus sts; pwr_tStatus sts;
/* Initialize. */ /* Initialize. */
errh_Init("pwr_tmon"); errh_Init("pwr_tmon", errh_eAnix_tmon);
errh_SetStatus( PWR__SRVSTARTUP);
qcom_Init(&sts, 0, "pwr_tmon"); qcom_Init(&sts, 0, "pwr_tmon");
if (EVEN (sts)) { if (EVEN (sts)) {
errh_Error("qcom_Init, %m", sts); errh_Error("qcom_Init, %m", sts);
errh_SetStatus( PWR__SRVTERM);
exit(sts); exit(sts);
} }
sts = gdh_Init("pwr_tmon"); sts = gdh_Init("pwr_tmon");
if (EVEN (sts)) { if (EVEN (sts)) {
errh_Error("gdh_Init, %m", sts); errh_Error("gdh_Init, %m", sts);
errh_SetStatus( PWR__SRVTERM);
exit(sts); exit(sts);
} }
...@@ -796,6 +847,7 @@ init( ...@@ -796,6 +847,7 @@ init(
subcCheck(newTimer(NULL, NULL, subcCheck)); subcCheck(newTimer(NULL, NULL, subcCheck));
} gdb_ScopeUnlock; } gdb_ScopeUnlock;
errh_SetStatus( PWR__SRUN);
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment