File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44#include <Arduino.h>
55
66/* Uncomment this to allow Exception Handling functionality */
7- // #define _PROCESS_EXCEPTION_HANDLING
7+ #define _PROCESS_EXCEPTION_HANDLING
88
99/* Uncomment this to allow the scheduler to interrupt long running processes */
1010// This requires _PROCESS_EXCEPTION_HANDLING to also be enabled
Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ class Process
138138#ifdef _PROCESS_EXCEPTION_HANDLING
139139
140140protected:
141+ inline void yield () { _scheduler.raiseException (LONGJMP_YIELD_CODE); }
141142 // By default do not handle
142143 virtual bool handleException (int e) { return false ; }
143144 virtual void raiseException (int e) { _scheduler.raiseException (e); }
Original file line number Diff line number Diff line change @@ -410,15 +410,26 @@ void Scheduler::handleHistOverFlow(uint8_t div)
410410 {
411411 if (e != 0 && _active)
412412 {
413- if (e == LONGJMP_ISR_CODE)
414- _active->handleWarning (WARNING_PROC_TIMED_OUT);
415- else if (!_active->handleException (e))
416- handleException (*_active, e);
413+ switch (e)
414+ {
415+ #ifdef _PROCESS_TIMEOUT_INTERRUPTS
416+ case LONGJMP_ISR_CODE:
417+ _active->handleWarning (WARNING_PROC_TIMED_OUT);
418+ break ;
419+ #endif
420+ case LONGJMP_YIELD_CODE:
421+ // no nothing
422+ break ;
423+
424+ default :
425+ if (!_active->handleException (e))
426+ handleException (*_active, e);
427+ break ;
417428
429+ }
418430 return true ;
419431 }
420432 return false ;
421-
422433 }
423434#endif
424435
You can’t perform that action at this time.
0 commit comments