Chris Johns commented on a discussion: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5641#note_154332


> Because `unlock()` is `noexcept`, libstdc++ cannot throw a 
> `std::system_error` even if `__gthread_mutex_unlock` returned an error code 
> (such as `EPERM`). If an exception were thrown, the runtime would immediately 
> trigger `std::terminate()`.

I read https://en.cppreference.com/cpp/thread/mutex/lock differently:

> ### Exceptions
>
> Throws std::system_error when errors occur, including errors from the 
> underlying operating system that would prevent `lock` from meeting its 
> specifications. The mutex is not locked in the case of any exception being 
> thrown.

Plus reading the code in C++ showed paths that could throw and path that did 
not. I was not sure if the different was based on options to the compiler.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5641#note_154332
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/sent_notifications/4-73ofh18tgzgjs923xul2zhi16-1d/unsubscribe
 | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | 
Help: https://gitlab.rtems.org/help


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to