Skip to content

Slow running after restart #31

@jthuermann

Description

@jthuermann

Hey, got a problem using your library: After I suspended my running thread and restarted it the while-loop is much slower

Code
void setup() {
int id = threads.addThread(drive);
while (true) {
if (digitalRead(BUTTON_PIN) == HIGH) {
Serial.println("Debug: Button pressed");
if (threads.getState(id) == Threads::RUNNING) {
threads.suspend(id);
} else {
threads.restart(id);
}
while (digitalRead(BUTTON_PIN) == HIGH) ;
}
}
}

void drive() {
int a = 0;
while (true) {
a++;
Serial.print(millis());
Serial.print(": ");
Serial.println(a);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions