File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 return _scheduler.add (*this , enableIfNot);
4444 }
4545
46+ bool Process::restart ()
47+ {
48+ return _scheduler.restart (*this );
49+ }
50+
4651
4752 bool Process::needsServicing (uint32_t start)
4853 {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class Process
2020 bool disable ();
2121 bool enable ();
2222 bool destroy ();
23+ bool restart ();
2324
2425 // /////////////////// GETTERS /////////////////////////
2526 inline Scheduler &scheduler () { return _scheduler; }
Original file line number Diff line number Diff line change @@ -98,6 +98,13 @@ bool Scheduler::destroy(Process &process)
9898 return op.queue (_queue);
9999}
100100
101+
102+ bool Scheduler::restart (Process &process)
103+ {
104+ QueableOperation op (&process, QueableOperation::RESTART_SERVICE);
105+ return op.queue (_queue);
106+ }
107+
101108bool Scheduler::halt ()
102109{
103110 QueableOperation op (QueableOperation::HALT);
@@ -238,6 +245,17 @@ void Scheduler::procDestroy(Process &process)
238245}
239246
240247
248+ void Scheduler::procRestart (Process &process)
249+ {
250+ if (isNotDestroyed (process)) {
251+ procDisable (process);
252+ process.cleanup ();
253+ }
254+ process.setup ();
255+ procEnable (process);
256+ }
257+
258+
241259void Scheduler::procAdd (Process &process)
242260{
243261 if (!isNotDestroyed (process)) {
@@ -324,6 +342,10 @@ void Scheduler::processQueue()
324342 procDestroy (*op.getProcess ());
325343 break ;
326344
345+ case QueableOperation::RESTART_SERVICE:
346+ procRestart (*op.getProcess ());
347+ break ;
348+
327349 case QueableOperation::HALT:
328350 procHalt ();
329351 break ;
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class Scheduler
1919 bool disable (Process &process);
2020 bool enable (Process &process);
2121 bool destroy (Process &process);
22+ bool restart (Process &process);
2223 bool halt ();
2324
2425 uint8_t getID (Process &process);
@@ -45,6 +46,7 @@ class Scheduler
4546 DESTROY_SERVICE,
4647 DISABLE_SERVICE,
4748 ENABLE_SERVICE,
49+ RESTART_SERVICE,
4850 HALT,
4951#ifdef _PROCESS_STATISTICS
5052 UPDATE_STATS,
@@ -69,6 +71,7 @@ class Scheduler
6971 void procEnable (Process &process);
7072 void procDestroy (Process &process);
7173 void procAdd (Process &process);
74+ void procRestart (Process &process);
7275 void procHalt ();
7376
7477 void processQueue ();
You can’t perform that action at this time.
0 commit comments