-->
Page 1 of 1

Why is yield() needed when delay() serves the same purpose?

PostPosted: Tue Aug 16, 2016 10:10 am
by helpme
I read that delay() achieves the same purpose as yield(). What is the difference between delay() and yield()? Why do we need yield() when delay() is enough?

Re: Why is yield() needed when delay() serves the same purpo

PostPosted: Tue Aug 16, 2016 10:29 am
by martinayotte
yield() is also checking in which context it is running, system or user context, if it is in system context, it will generate a Panic. delay(0) doesn't do that check.

Re: Why is yield() needed when delay() serves the same purpo

PostPosted: Fri May 05, 2017 5:10 pm
by testato
sorry but i do not understand, may you made some examples ?

Re: Why is yield() needed when delay() serves the same purpo

PostPosted: Sat May 06, 2017 10:33 am
by martinayotte
This is the core showing the code about the panic :

https://github.com/esp8266/Arduino/blob ... p#L93-L101