• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Révision21126fb978deae482b2ed5a55a6aa255674536fd (tree)
l'heure2019-11-14 13:21:27
AuteurAlistair Strachan <astrachan@goog...>
CommiterChih-Wei Huang

Message de Log

Fall back to CLOCK_BOOTTIME if CLOCK_BOOTTIME_ALARM fails

If the cuttlefish device does not have an rtc device (such as the crosvm
VMM) the bt osi layer can promote crashes due to it not being able to
create a CLOCK_BOOTTIME_ALARM timer. Bring back a fallback but enable it
at runtime instead of compile time.

Bug: 126955943
Test: run with cuttlefish
Change-Id: I3ab0282b3e8fde776aa7b37d5772c8f62cf957bf

Change Summary

Modification

--- a/osi/src/alarm.cc
+++ b/osi/src/alarm.cc
@@ -115,12 +115,6 @@ struct alarm_t {
115115 int64_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS = 3000;
116116 static const clockid_t CLOCK_ID = CLOCK_BOOTTIME;
117117
118-#if (KERNEL_MISSING_CLOCK_BOOTTIME_ALARM == TRUE)
119-static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME;
120-#else
121-static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME_ALARM;
122-#endif
123-
124118 // This mutex ensures that the |alarm_set|, |alarm_cancel|, and alarm callback
125119 // functions execute serially and not concurrently. As a result, this mutex
126120 // also protects the |alarms| list.
@@ -330,7 +324,11 @@ static bool lazy_initialize(void) {
330324 if (!timer_create_internal(CLOCK_ID, &timer)) goto error;
331325 timer_initialized = true;
332326
333- if (!timer_create_internal(CLOCK_ID_ALARM, &wakeup_timer)) goto error;
327+ if (!timer_create_internal(CLOCK_BOOTTIME_ALARM, &wakeup_timer)) {
328+ if (!timer_create_internal(CLOCK_BOOTTIME, &wakeup_timer)) {
329+ goto error;
330+ }
331+ }
334332 wakeup_timer_initialized = true;
335333
336334 alarm_expired = semaphore_new(0);