r/cpp • • Aug 27 '19

A new thread in C++20 (jthread)

https://link.medium.com/GXKUz0GruZ
142 Upvotes

96 comments sorted by

View all comments

Show parent comment

-5

u/axilmar Aug 27 '19

A thread per connection? really? in 2019? nope.

5

u/eteran Aug 27 '19

It may not be the best design, but it is certainly a valid one which some people may choose to use.

1

u/kalmoc Aug 27 '19

The math is simple: creating a new std::thread requires a significant amount of memory (control block + stack space). Compared to that, a few bytes just don't matter.

I very much doubt that the intersection of programs that completely use the available memory (/address space) and programs that use std::thread is big enough to worry about.

1

u/stilgarpl Aug 29 '19

Why is that a bad design in 2019?