Skip to content

Commit 8b98e6a

Browse files
committed
setTimeout is atomic
1 parent 06156f0 commit 8b98e6a

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/ProcessScheduler/Process.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@
119119
}
120120

121121

122+
#ifdef _PROCESS_TIMEOUT_INTERRUPTS
123+
124+
void Process::setTimeout(uint32_t timeout)
125+
{
126+
// Can not let interrupt happen
127+
ATOMIC_START
128+
{
129+
_timeout = timeout;
130+
}
131+
ATOMIC_END
132+
}
133+
134+
135+
#endif
136+
122137
#ifdef _PROCESS_STATISTICS
123138

124139
uint32_t Process::getAvgRunTime()

src/ProcessScheduler/Process.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Process
100100
public:
101101
inline uint32_t getTimeout() {return _timeout;}
102102
protected:
103-
inline void setTimeout(uint32_t timeout) { _timeout = timeout; }
103+
void setTimeout(uint32_t timeout);
104104
private:
105105
uint32_t _timeout;
106106

0 commit comments

Comments
 (0)