Fun fact, besides std::current_exception, which requires TLS, exceptions should work so long as you put noexcept on your thread functions (or wrap them), that way the unwinder knows to stop unwinding at the thread boundary. When I implement <thread> (with stack size hint) for FreeRTOS, it'll take care of all of the noexcept and TLS stuff for you so you get access to the current exception. And for those that don't want to use std::thread with a stack hint and name, I can do a write up for enabling TLS for exceptions for FreeRTOS. And if you use a different RTOS, then we can look into supporting them as well. So stay tuned. π
I am using FreeRTOS and we are not using std::thread we have our own abstraction around FreeRTOS so a simple description or write up would be super helpful. And I will stay tuned -- do not worry about that -- because it will fall to me to implement it later on and the developers I support are really tired of writing:
if (auto result = some_object.some_call_that_returns_expected(); !result) {
View all comments
Show parent comment
3
u/theICEBear_dk Aug 22 '25
Oh it will be on ARM in the beginning. My main worry at the moment is getting it to work with an RTOS.