KierannCode / Playground

Project about creating a game engine with SDL from scratch, this is for fun and for my personal experience only
0 stars 0 forks source link

Improve OSDL::Mutex resilience #11

Open KierannCode opened 3 years ago

KierannCode commented 3 years ago

The mutex implementation relies only SDL implementation. Therefore, bad use results in undefined behavior. It would be better to have exceptions thrown instead, but this might affect global performance, and thus should be implemented in the dev branch

KierannCode commented 3 years ago

Little warning here : a destructor should never throw an exception. In this case, a check of the state of the mutex must be done in the destructor, and log a warning (maybe an error) if the mutex was locked when it was called.