Go Down

Topic: Arduino Due Task Scheduler (Read 12771 times) previous topic - next topic

pYro_65

#15
Nov 15, 2012, 03:55 am Last Edit: Nov 15, 2012, 03:59 am by pYro_65 Reason: 1
From what I can tell, yield has a similar effect to the task actually exiting; it simply moves focus to the next task. I don't think you even need to use it in some circumstances. 'suspend()' may be a better name.

It is handy for breaking a 'long' operation; for example calculating PI to 6000 places in one hit halts everything else on the system for quite some time.

Data buffers could overflow if they aren't read often enough; SPI may be interrupt driven, but the code using it may not be, and will require a slice of time to act on the data.

Paul Stoffregen

Yes, yield() is useful if you write a program than does a lot of work and you care about letting other stuff run.

But its main purpose is for libraries that wait.  For example, inside Serial.print(), if the transmit buffer is full, yield() is called while it waits for space in the buffer.

Go Up