Idle thread slows down system


Active member
Hi everyone,
I have a Teensy 4.1 on which I want to use TeensyThreads.

I found out that if a thread is active, even when it is doing nothing it slows down the rest of the system dramatically.

void doNothing(){
  while (1) {

void doSomeCalc(){
  elapsedMillis msec = 0;

  float j = 1.3;
  for (uint32_t i=0; i<0xFFFFFFF; i++){
    j = j + 1.1;
  Serial.printf("%f", j);
  Serial.printf(" test ran for %.2f seconds\n", (float)msec / 1000.0f);

The function "doSomeCalc()" (see above) is running for 4.49 secs if function "doNothing()" is inactive.
If I start doNothing via a thread (threads.addThread(doNothing)) the execution time for "doSomeCalc()" rises to 8.99 secs.
If I start a second doNothing() thread the execution time for doSomeCalc() goes up to 13.49 secs.
Is that the intended behaviour?
I would expect that the execution time would rise a little bit due to task switch losses but not 50%. Did I miss something?
Maybe the function "delay()" does not really sleeps but burns 100% processing power? That would explain why the execution time doubles when "doNothing()" is running.
Seemed to be the case.
If I use "threads.delay(100)" instead of "delay(100)" it is working as expected.