Interruptable sleep functions#374
Conversation
|
Up for discussion: should the behavior of the "default" versions of I'm thinking this may be the correct move since there may be some edge case where another project uses delay() to wait for an interrupt signal. |
|
I think the new delay function should have the same behavior as the old one. |
7b297a6 to
bd6956c
Compare
bd6956c to
83d5f80
Compare
Ok, in that case, I'll remove the loop around The non-interruptable behavior (loop included) is now in the non-interruptable functions |
|
BTW, this should be the last major change to the |
The original versions of
delayOld()anddelayMicrosecondsOld()usednanosleep()not in a loop, meaning that if the process received a system interrupt signal sleep would halt and not resume, unlessdelayMicrosecondsHard()was used. Current implementations ofdelay()etc. do resume sleep if interrupted.The new functionsdelayInterruptable(),delayMicrosecondsInterruptable(), anddelayNanosecondsInterruptable()do not resume after a system interrupt is received, akin to the old non-hard delay functions.The functions
delay(),delayMicroseconds(), anddelayNanoseconds()has been changed so that their calls toclock_nanosleep()are not inside a loop, mirroring the original behavior.New non-interruptable functions
delayNI(),delayMicrosecondsNI(), anddelayNanosecondsNI()have been added alongside a new helperdelayHelperNI()which are simply the loop-resuming versions of their counterparts before this change.