Delete use of pthread_cond_timedwait_relative_np.
This appears to be a deprecated android function (available only for __ANDROID_API__ < 21), and it's been reported to cause performance problems on certain android devices (see bug for details). Bug: webrtc:8722 Change-Id: I7ef4b6f98c4910246007ce1e262884c84b5f0efa Reviewed-on: https://webrtc-review.googlesource.com/38700 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21572}
This commit is contained in:
parent
10b96ebcad
commit
6f9c01fb58
@ -85,12 +85,6 @@ bool Event::Wait(int milliseconds) {
|
||||
// Converting from seconds and microseconds (1e-6) plus
|
||||
// milliseconds (1e-3) to seconds and nanoseconds (1e-9).
|
||||
|
||||
#ifdef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
|
||||
// Use relative time version, which tends to be more efficient for
|
||||
// pthread implementations where provided (like on Android).
|
||||
ts.tv_sec = milliseconds / 1000;
|
||||
ts.tv_nsec = (milliseconds % 1000) * 1000000;
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
||||
@ -102,18 +96,12 @@ bool Event::Wait(int milliseconds) {
|
||||
ts.tv_sec++;
|
||||
ts.tv_nsec -= 1000000000;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&event_mutex_);
|
||||
if (milliseconds != kForever) {
|
||||
while (!event_status_ && error == 0) {
|
||||
#ifdef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE
|
||||
error = pthread_cond_timedwait_relative_np(
|
||||
&event_cond_, &event_mutex_, &ts);
|
||||
#else
|
||||
error = pthread_cond_timedwait(&event_cond_, &event_mutex_, &ts);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
while (!event_status_ && error == 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user