electron/patches/common/webrtc/webrtc-rwlock_null.patch
Jeremy Apthorp 76c5f5cc8a
build: move libcc patches to electron repo (#14104)
In the GN build, libchromiumcontent is no longer a distinct library, but
merely a container for a set of scripts and patches. Maintaining those
patches in a separate repository is tedious and error-prone, so merge
them into the main repo.

Once this is merged and GN is the default way to build Electron, the
libchromiumcontent repository can be archived.
2018-09-13 22:02:16 -07:00

36 lines
964 B
Diff

diff --git a/rtc_base/synchronization/rw_lock_wrapper.cc b/rtc_base/synchronization/rw_lock_wrapper.cc
index c8cd17edb8..50c6e25ad9 100644
--- a/rtc_base/synchronization/rw_lock_wrapper.cc
+++ b/rtc_base/synchronization/rw_lock_wrapper.cc
@@ -11,6 +11,9 @@
#include "rtc_base/synchronization/rw_lock_wrapper.h"
#include <assert.h>
+#include <stdlib.h>
+
+#include "system_wrappers/include/sleep.h"
#if defined(_WIN32)
#include "rtc_base/synchronization/rw_lock_win.h"
@@ -21,11 +23,19 @@
namespace webrtc {
RWLockWrapper* RWLockWrapper::CreateRWLock() {
+ RWLockWrapper* rw_lock_ptr;
#ifdef _WIN32
- return RWLockWin::Create();
+ rw_lock_ptr = RWLockWin::Create();
#else
- return RWLockPosix::Create();
+ rw_lock_ptr = RWLockPosix::Create();
#endif
+ if (rw_lock_ptr != NULL) {
+ return rw_lock_ptr;
+ } else {
+ int msec_wait = 10 + (rand() % 90);
+ SleepMs(msec_wait);
+ return CreateRWLock();
+ }
}
} // namespace webrtc