mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 07:53:34 +08:00
platforms: use CLOCK_MONOTONIC
For the non-lockstep case we want to use CLOCK_MONOTONIC if possible.
This commit is contained in:
@@ -58,6 +58,12 @@ int px4_sem_init(px4_sem_t *s, int pshared, unsigned value)
|
||||
pthread_cond_init(&(s->wait), nullptr);
|
||||
pthread_mutex_init(&(s->lock), nullptr);
|
||||
|
||||
// We want to use CLOCK_MONOTONIC if possible.
|
||||
pthread_condattr_t attr;
|
||||
pthread_condattr_init(&attr);
|
||||
pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
|
||||
pthread_cond_init(&(s->wait), &attr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user