lockstep_scheduler: avoid pthread_cond_destroy on at_exit

The static object is destroyed on at_exit while threads might still be
inside a CS. This can lead to a hanging process.
Cleaner would be to gracefully stop the threads.

According to https://linux.die.net/man/3/pthread_cond_destroy:
Attempting to destroy a condition variable upon which other threads are
currently blocked results in undefined behavior.
This commit is contained in:
Beat Küng
2023-01-30 11:45:02 +01:00
parent f25abbc80a
commit 0687fd2689
4 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -53,7 +53,7 @@
#if defined(ENABLE_LOCKSTEP_SCHEDULER)
#include <lockstep_scheduler/lockstep_scheduler.h>
static LockstepScheduler lockstep_scheduler {};
static LockstepScheduler lockstep_scheduler {true};
#endif
// Intervals in usec