Click here to Skip to main content
15,887,585 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: Wordle 351 Pin
Sander Rossel5-Jun-22 3:16
professionalSander Rossel5-Jun-22 3:16 
Rantpthread stupidity PinPopular
Greg Utas4-Jun-22 5:08
professionalGreg Utas4-Jun-22 5:08 
GeneralRe: pthread stupidity Pin
PIEBALDconsult4-Jun-22 5:34
mvePIEBALDconsult4-Jun-22 5:34 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 5:51
professionalGreg Utas4-Jun-22 5:51 
GeneralRe: pthread stupidity Pin
Randor 4-Jun-22 6:36
professional Randor 4-Jun-22 6:36 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 7:23
professionalGreg Utas4-Jun-22 7:23 
GeneralRe: pthread stupidity Pin
Mircea Neacsu4-Jun-22 7:57
Mircea Neacsu4-Jun-22 7:57 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 8:56
professionalGreg Utas4-Jun-22 8:56 
I did indeed look at <thread> and almost decided to wrap it, which would have been a fairly straightforward evolution. But I decided not to:
  • It wouldn't eliminate much code. (I'd started before C++11, so porting to Linux finally did get me to convert to <mutex>, <condition_variable>, <chrono>, and <filesystem> instead of writing Linux targets for what I use from them.)
  • It doesn't let you specify the stack size. Most platforms have a default stack size that is far larger than what makes sense to me.
  • It doesn't let you create a thread that is already detached. Not a big deal, but I create them detached.
  • thread::id is opaque. I want an identifier that I can see and use as a std::map key. Actually, it supports stream operator<< and std::map, but it annoyed me. Figuring out how to support <chrono> in my static analysis tool, given its dependence on <ratio> and its rat's nest of template metaprogramming, already had me in a pissy mood.
  • thread::native_handle_type is platform-specific.
  • If you wrap a simple thread with a Thread object that provides lots more capabilities, a new thread can start to run before its Thread object has been fully constructed. This, not to understate it, is a Very Bad Thing, and I didn't want to end up solving it again if <thread> broke my solution.
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.

GeneralRe: pthread stupidity Pin
Mircea Neacsu4-Jun-22 9:26
Mircea Neacsu4-Jun-22 9:26 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 9:45
professionalGreg Utas4-Jun-22 9:45 
GeneralRe: pthread stupidity Pin
Mircea Neacsu4-Jun-22 10:22
Mircea Neacsu4-Jun-22 10:22 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 10:50
professionalGreg Utas4-Jun-22 10:50 
GeneralRe: pthread stupidity Pin
Randor 4-Jun-22 9:38
professional Randor 4-Jun-22 9:38 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 9:54
professionalGreg Utas4-Jun-22 9:54 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 7:29
professionalGreg Utas4-Jun-22 7:29 
GeneralRe: pthread stupidity Pin
Randor 4-Jun-22 7:37
professional Randor 4-Jun-22 7:37 
GeneralRe: pthread stupidity Pin
Greg Utas4-Jun-22 7:47
professionalGreg Utas4-Jun-22 7:47 
GeneralRe: pthread stupidity Pin
Paul Sanders (the other one)5-Jun-22 22:20
Paul Sanders (the other one)5-Jun-22 22:20 
GeneralRe: pthread stupidity Pin
Greg Utas5-Jun-22 23:26
professionalGreg Utas5-Jun-22 23:26 
GeneralRe: pthread stupidity Pin
Paul Sanders (the other one)6-Jun-22 1:15
Paul Sanders (the other one)6-Jun-22 1:15 
GeneralRe: pthread stupidity Pin
Greg Utas6-Jun-22 1:30
professionalGreg Utas6-Jun-22 1:30 
GeneralRe: pthread stupidity Pin
Paul Sanders (the other one)6-Jun-22 9:45
Paul Sanders (the other one)6-Jun-22 9:45 
JokeThe day physicists made the casino weep! Pin
Cp-Coder4-Jun-22 2:22
Cp-Coder4-Jun-22 2:22 
GeneralRe: The day physicists made the casino weep! Pin
OriginalGriff4-Jun-22 2:50
mveOriginalGriff4-Jun-22 2:50 
GeneralRe: The day physicists made the casino weep! Pin
theoldfool4-Jun-22 3:19
professionaltheoldfool4-Jun-22 3:19 

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.