Click here to Skip to main content
15,885,216 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.

 
GeneralAnd when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch27-Feb-21 13:10
mvahoney the codewitch27-Feb-21 13:10 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Marc Clifton27-Feb-21 13:15
mvaMarc Clifton27-Feb-21 13:15 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch27-Feb-21 13:15
mvahoney the codewitch27-Feb-21 13:15 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Greg Utas27-Feb-21 13:38
professionalGreg Utas27-Feb-21 13:38 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Gary R. Wheeler27-Feb-21 13:31
Gary R. Wheeler27-Feb-21 13:31 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch27-Feb-21 13:45
mvahoney the codewitch27-Feb-21 13:45 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016791-Mar-21 20:33
Member 133016791-Mar-21 20:33 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch2-Mar-21 2:58
mvahoney the codewitch2-Mar-21 2:58 
1. I don't write my own concurrency safe queues because FreeRTOS has one and so does .NET so I've not had the need.

2. Yeah, when I wrote a ring buffer in C# I did that

3. I don't know a good reason to use that over say, std::atomic. In my experience, anything that won't support std::atomic won't support atomic CMPXCHG operations at the CPU level anyway, at least not that way. With the atMega2560 for example, IIRC it doesn't have one, forcing you to disable interrupts and then reenable them after the operation is complete. Don't quote me on the mega's capabilities, I'm not an AVR expert. It might be a bad example.

Particularly, #3 is curious to me. Why wouldn't you use for example, std::atomic_int?

Is it because it's a C++ thing? I use C++ even on 8-bit machines with 4kb of RAM. I just severely limit my use of things like The STL to the bare minimum. std::atomic is one area I use. std::chrono is another. Why? Because writing cross platform CMPXCHNG and timer code is error prone and i don't have access to all that hardware.
Real programmers use butterflies

GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016792-Mar-21 3:20
Member 133016792-Mar-21 3:20 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch2-Mar-21 3:24
mvahoney the codewitch2-Mar-21 3:24 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016792-Mar-21 3:38
Member 133016792-Mar-21 3:38 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch2-Mar-21 3:54
mvahoney the codewitch2-Mar-21 3:54 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016792-Mar-21 10:58
Member 133016792-Mar-21 10:58 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch2-Mar-21 11:02
mvahoney the codewitch2-Mar-21 11:02 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016792-Mar-21 11:17
Member 133016792-Mar-21 11:17 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch2-Mar-21 13:22
mvahoney the codewitch2-Mar-21 13:22 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016792-Mar-21 13:28
Member 133016792-Mar-21 13:28 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch2-Mar-21 13:30
mvahoney the codewitch2-Mar-21 13:30 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016792-Mar-21 13:39
Member 133016792-Mar-21 13:39 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch2-Mar-21 14:26
mvahoney the codewitch2-Mar-21 14:26 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016792-Mar-21 19:59
Member 133016792-Mar-21 19:59 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
honey the codewitch3-Mar-21 0:41
mvahoney the codewitch3-Mar-21 0:41 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Member 133016793-Mar-21 0:46
Member 133016793-Mar-21 0:46 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
Greg Utas27-Feb-21 13:43
professionalGreg Utas27-Feb-21 13:43 
GeneralRe: And when you depend on multithreading to be unpredictable, it isn't! Pin
markrlondon27-Feb-21 13:56
markrlondon27-Feb-21 13:56 

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.