system/corennnnn
Revisão | aa631f1f713fb458d49d75f67adedd3f82ce7595 (tree) |
---|---|
Hora | 2016-09-02 21:08:02 |
Autor | Jaap Jan Meijer <jjmeijer88@gmai...> |
Commiter | Jaap Jan Meijer |
Merge remote-tracking branch 'cm/cm-13.0' into cm-13.0-x86
@@ -121,9 +121,11 @@ int64_t elapsedRealtimeNano() | ||
121 | 121 | #endif |
122 | 122 | |
123 | 123 | static int s_fd = -1; |
124 | + bool need_unlock = false; | |
124 | 125 | |
125 | 126 | if (clock_method < 0) { |
126 | 127 | pthread_mutex_lock(&clock_lock); |
128 | + need_unlock = true; | |
127 | 129 | } |
128 | 130 | |
129 | 131 | if (clock_method < 0 || clock_method == METHOD_IOCTL) { |
@@ -143,6 +145,8 @@ int64_t elapsedRealtimeNano() | ||
143 | 145 | checkTimeStamps(timestamp, &prevTimestamp, &prevMethod, METHOD_IOCTL); |
144 | 146 | if (clock_method < 0) { |
145 | 147 | clock_method = METHOD_IOCTL; |
148 | + } | |
149 | + if (need_unlock) { | |
146 | 150 | pthread_mutex_unlock(&clock_lock); |
147 | 151 | } |
148 | 152 | return timestamp; |
@@ -159,6 +163,8 @@ int64_t elapsedRealtimeNano() | ||
159 | 163 | METHOD_CLOCK_GETTIME); |
160 | 164 | if (clock_method < 0) { |
161 | 165 | clock_method = METHOD_CLOCK_GETTIME; |
166 | + } | |
167 | + if (need_unlock) { | |
162 | 168 | pthread_mutex_unlock(&clock_lock); |
163 | 169 | } |
164 | 170 | return timestamp; |
@@ -173,6 +179,8 @@ int64_t elapsedRealtimeNano() | ||
173 | 179 | METHOD_SYSTEMTIME); |
174 | 180 | if (clock_method < 0) { |
175 | 181 | clock_method = METHOD_SYSTEMTIME; |
182 | + } | |
183 | + if (need_unlock) { | |
176 | 184 | pthread_mutex_unlock(&clock_lock); |
177 | 185 | } |
178 | 186 | return timestamp; |