Skip to content

Commit 06156f0

Browse files
committed
Modified getTimeout() and setTimeout()
1 parent 428099d commit 06156f0

4 files changed

Lines changed: 24 additions & 16 deletions

File tree

src/ProcessScheduler/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/* Uncomment this to allow the scheduler to interrupt long running processes */
1010
// This requires _PROCESS_EXCEPTION_HANDLING to also be enabled
11-
//#define _PROCESS_TIMEOUT_INTERRUPTS
11+
#define _PROCESS_TIMEOUT_INTERRUPTS
1212

1313
/* Uncomment this to allow Process timing statistics functionality */
1414
#define _PROCESS_STATISTICS

src/ProcessScheduler/Includes.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ typedef enum ProcessWarning
1818
#endif
1919
} ProcessWarning;
2020

21+
// Process period
22+
#define SERVICE_CONSTANTLY 0
23+
#define SERVICE_SECONDLY 1000
24+
#define SERVICE_MINUTELY 60000
25+
#define SERVICE_HOURLY 3600000
26+
27+
// Number of Processs
28+
#define RUNTIME_FOREVER -1
29+
#define RUNTIME_ONCE 1
30+
31+
#define PROCESS_NO_TIMEOUT 0
32+
33+
#define OVERSCHEDULED_NO_WARNING 0
34+
2135
// PICK INT VALUES PEOPLE UNLIKLEY TO USE
2236
#define LONGJMP_ISR_CODE -1000
2337
#define LONGJMP_YIELD_CODE -1001

src/ProcessScheduler/Process.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
this->_force = false;
1515
this->_overSchedThresh = overSchedThresh;
1616
this->_pBehind = 0;
17+
#ifdef _PROCESS_TIMEOUT_INTERRUPTS
18+
setTimeout(PROCESS_NO_TIMEOUT);
19+
#endif
1720
}
1821

1922

src/ProcessScheduler/Process.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@
44
#include "Includes.h"
55
#include "Scheduler.h"
66

7-
// Process period
8-
#define SERVICE_CONSTANTLY 0
9-
#define SERVICE_SECONDLY 1000
10-
#define SERVICE_MINUTELY 60000
11-
#define SERVICE_HOURLY 3600000
12-
13-
// Number of Processs
14-
#define RUNTIME_FOREVER -1
15-
#define RUNTIME_ONCE 1
16-
17-
#define OVERSCHEDULED_NO_WARNING 0
18-
197
class Scheduler;
208

219

@@ -51,9 +39,6 @@ class Process
5139

5240
inline ProcPriority getPriority() { return _pLevel; }
5341

54-
// Timeout
55-
virtual uint32_t getTimeout() { return 0; };
56-
5742
protected:
5843
inline uint32_t getStartDelay() { return _actualTS - _scheduledTS; }
5944
// Fired on creation/destroy
@@ -112,6 +97,12 @@ class Process
11297

11398
#ifdef _PROCESS_TIMEOUT_INTERRUPTS
11499

100+
public:
101+
inline uint32_t getTimeout() {return _timeout;}
102+
protected:
103+
inline void setTimeout(uint32_t timeout) { _timeout = timeout; }
104+
private:
105+
uint32_t _timeout;
115106

116107
#endif
117108

0 commit comments

Comments
 (0)