Skip to content

Commit cd4560f

Browse files
committed
Detailed method documentation
1 parent 6ecddf4 commit cd4560f

5 files changed

Lines changed: 263 additions & 49 deletions

File tree

src/ProcessScheduler/Includes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ class Process;
1111

1212
typedef enum ProcessWarning
1313
{
14+
// This Process is scheduled to often
1415
WARNING_PROC_OVERSCHEDULED = 0,
1516

1617
#ifdef _PROCESS_TIMEOUT_INTERRUPTS
18+
// The scheduler interrupted your process service routine because it was taking longer than timeout set
19+
// This will likley leave you Process in an unknown state, perhaps call restart()
1720
WARNING_PROC_TIMED_OUT
1821
#endif
1922
} ProcessWarning;

src/ProcessScheduler/Process.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,31 @@
33

44
/*********** PUBLIC *************/
55
Process::Process(Scheduler &scheduler, ProcPriority priority, uint32_t period,
6-
int iterations, int16_t overSchedThresh)
6+
int iterations, uint16_t overSchedThresh)
77
: _scheduler(scheduler), _pLevel(priority)
88
{
99
this->_enabled = false;
1010
this->_period = period;
1111
this->_iterations = iterations;
12-
this->_scheduledTS = _scheduler.getCurrTS();
13-
this->_actualTS = _scheduler.getCurrTS();
1412
this->_force = false;
1513
this->_overSchedThresh = overSchedThresh;
16-
this->_pBehind = 0;
14+
resetTimeStamps();
15+
1716
#ifdef _PROCESS_TIMEOUT_INTERRUPTS
1817
setTimeout(PROCESS_NO_TIMEOUT);
1918
#endif
2019
}
2120

22-
21+
void Process::resetTimeStamps()
22+
{
23+
ATOMIC_START
24+
{
25+
this->_scheduledTS = _scheduler.getCurrTS();
26+
this->_actualTS = _scheduler.getCurrTS();
27+
this->_pBehind = 0;
28+
}
29+
ATOMIC_END
30+
}
2331

2432
bool Process::disable()
2533
{

0 commit comments

Comments
 (0)