I don't want to use C++11 std::thread
because of exceptions. Is it possible to use C11's threads from C++ (for some version)?
Asked
Active
Viewed 166 times
1

tuket
- 3,232
- 1
- 26
- 41
-
1Sounds like a XY problem. If you disable Exception you wont get any. Also why do you explicitly want no exceptions? – Raildex Feb 23 '22 at 12:50
-
2See this: https://stackoverflow.com/questions/12483425/mixing-c11-stdthread-and-c-system-threads-ie-pthreads (especially the answer from Jens Gustedt) – nielsen Feb 23 '22 at 12:53
-
1Could you be more specific than "because of exceptions"? What's your issue with them in this context? – molbdnilo Feb 23 '22 at 12:55
-
The code base I'm working with has exceptions disabled, so I can't check if the thread creation has failed – tuket Feb 23 '22 at 12:57
-
@nielsen Thanks for the link! According to that, I should be able to use C11's thread library from C++11. But I'm not sure if I can trust that answer since it doesn't provide any source I can verify. Besides, I know C++11 was supported in MSVC17 but C11 wasn't supported until MSVC2019. – tuket Feb 23 '22 at 13:05
-
[std::thread without exceptions?](https://stackoverflow.com/q/14162287/995714) – phuclv Feb 23 '22 at 14:35
-
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/beginthread-beginthreadex – Paul Sanders Feb 24 '22 at 08:47