Click here to Skip to main content
15,898,792 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Simon Says Pin
Randor 22-Feb-21 12:16
professional Randor 22-Feb-21 12:16 
GeneralRe: Simon Says Pin
Gerry Schmitz22-Feb-21 12:24
mveGerry Schmitz22-Feb-21 12:24 
GeneralRe: Simon Says Pin
Randor 22-Feb-21 12:29
professional Randor 22-Feb-21 12:29 
GeneralRe: Simon Says Pin
Jörgen Andersson22-Feb-21 21:01
professionalJörgen Andersson22-Feb-21 21:01 
GeneralMulti-tasking... Pin
Daniel Pfeffer22-Feb-21 8:09
professionalDaniel Pfeffer22-Feb-21 8:09 
GeneralRe: Multi-tasking... Pin
honey the codewitch22-Feb-21 9:09
mvahoney the codewitch22-Feb-21 9:09 
GeneralRe: Multi-tasking... Pin
Rick York22-Feb-21 10:24
mveRick York22-Feb-21 10:24 
GeneralRe: Multi-tasking... Pin
honey the codewitch22-Feb-21 10:31
mvahoney the codewitch22-Feb-21 10:31 
I've also found that introducing multithreading into a system you already can't debug using a traditional debugger is a recipe for a nightmare in practice.

What I've done on this dual core monster I am working with is I keep exactly two threads - each with its own core affinity, and they basically do very little communication with each other, and all of their work is internally cooperatively multitasked.

It doesn't have an RTC per se, but like most CPUs it has a timing crystal connected so you can get the number of milliseconds since boot with it. I use that to make timers.

C++
static uint32_t tickTS=0;

void loop() {
    if(millis()-tickTS>=1000) {
        tickTS=millis();
        Serial.println("One second elapsed");
    }
}


You can even wrap that to turn it into a callback. or whatever.

but i do all my cooperatively multithreaded code such that if i have to make a time delay for example, I use the above mechanism to avoid blocking. I do this on the code for each of the threads/cores.
Real programmers use butterflies

GeneralRe: Multi-tasking... Pin
Rick York22-Feb-21 14:17
mveRick York22-Feb-21 14:17 
GeneralRe: Multi-tasking... Pin
honey the codewitch22-Feb-21 14:46
mvahoney the codewitch22-Feb-21 14:46 
GeneralRe: Multi-tasking... Pin
trønderen22-Feb-21 9:45
trønderen22-Feb-21 9:45 
GeneralNot New - but worth the post Pin
W Balboos, GHB22-Feb-21 5:32
W Balboos, GHB22-Feb-21 5:32 
GeneralRe: Not New - but worth the post Pin
Eddy Vluggen22-Feb-21 12:14
professionalEddy Vluggen22-Feb-21 12:14 
JokeRe: Not New - but worth the post Pin
W Balboos, GHB23-Feb-21 0:25
W Balboos, GHB23-Feb-21 0:25 
GeneralRe: Not New - but worth the post Pin
markrlondon22-Feb-21 13:00
markrlondon22-Feb-21 13:00 
GeneralThought of the Day Pin
OriginalGriff22-Feb-21 5:10
mveOriginalGriff22-Feb-21 5:10 
GeneralRe: Thought of the Day Pin
honey the codewitch22-Feb-21 5:30
mvahoney the codewitch22-Feb-21 5:30 
GeneralRe: Thought of the Day Pin
W Balboos, GHB22-Feb-21 5:34
W Balboos, GHB22-Feb-21 5:34 
GeneralRe: Thought of the Day Pin
cegarman22-Feb-21 5:57
cegarman22-Feb-21 5:57 
GeneralRe: Thought of the Day Pin
Mike Hankey22-Feb-21 6:11
mveMike Hankey22-Feb-21 6:11 
GeneralRe: Thought of the Day Pin
jeron122-Feb-21 6:27
jeron122-Feb-21 6:27 
GeneralRe: Thought of the Day Pin
RickZeeland22-Feb-21 6:52
mveRickZeeland22-Feb-21 6:52 
GeneralRe: Thought of the Day Pin
Daniel Pfeffer22-Feb-21 8:20
professionalDaniel Pfeffer22-Feb-21 8:20 
GeneralRe: Thought of the Day Pin
Eddy Vluggen22-Feb-21 12:17
professionalEddy Vluggen22-Feb-21 12:17 
GeneralDrive By's Pin
#realJSOP22-Feb-21 4:28
professional#realJSOP22-Feb-21 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   436 votes