diff options
Diffstat (limited to 'absl/synchronization/mutex.cc')
-rw-r--r-- | absl/synchronization/mutex.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/absl/synchronization/mutex.cc b/absl/synchronization/mutex.cc index 3e8033a0b6de..76bd307a4d41 100644 --- a/absl/synchronization/mutex.cc +++ b/absl/synchronization/mutex.cc @@ -901,11 +901,15 @@ static PerThreadSynch *Enqueue(PerThreadSynch *head, // base_internal::CycleClock::Now() is 0.5%. int policy; struct sched_param param; - pthread_getschedparam(pthread_self(), &policy, ¶m); - s->priority = param.sched_priority; - s->next_priority_read_cycles = - now_cycles + - static_cast<int64_t>(base_internal::CycleClock::Frequency()); + const int err = pthread_getschedparam(pthread_self(), &policy, ¶m); + if (err != 0) { + ABSL_RAW_LOG(ERROR, "pthread_getschedparam failed: %d", err); + } else { + s->priority = param.sched_priority; + s->next_priority_read_cycles = + now_cycles + + static_cast<int64_t>(base_internal::CycleClock::Frequency()); + } } if (s->priority > head->priority) { // s's priority is above head's // try to put s in priority-fifo order, or failing that at the front. |