Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: webrtc/base/sigslot.cc

Issue 2509733003: Rewrite of sigslot that avoids vtables. (Closed)
Patch Set: Attempting to fix Windows issue due to different function pointer sizes. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/base/sigslot.cc
diff --git a/webrtc/base/sigslot.cc b/webrtc/base/sigslot.cc
index 9628217dc0729b0847c97a4567650beae235afd8..2fdb214b5200f76e4503c4aa4dd92fe250312696 100644
--- a/webrtc/base/sigslot.cc
+++ b/webrtc/base/sigslot.cc
@@ -12,43 +12,11 @@ namespace sigslot {
#ifdef _SIGSLOT_HAS_POSIX_THREADS
-multi_threaded_global::multi_threaded_global() {
- pthread_mutex_init(get_mutex(), NULL);
-}
-
-multi_threaded_global::multi_threaded_global(const multi_threaded_global&) {
-}
-
-multi_threaded_global::~multi_threaded_global() = default;
-
-void multi_threaded_global::lock() {
- pthread_mutex_lock(get_mutex());
-}
-
-void multi_threaded_global::unlock() {
- pthread_mutex_unlock(get_mutex());
-}
-
-multi_threaded_local::multi_threaded_local() {
- pthread_mutex_init(&m_mutex, NULL);
-}
-
-multi_threaded_local::multi_threaded_local(const multi_threaded_local&) {
- pthread_mutex_init(&m_mutex, NULL);
-}
-
-multi_threaded_local::~multi_threaded_local() {
- pthread_mutex_destroy(&m_mutex);
-}
-
-void multi_threaded_local::lock() {
- pthread_mutex_lock(&m_mutex);
-}
-
-void multi_threaded_local::unlock() {
- pthread_mutex_unlock(&m_mutex);
+pthread_mutex_t* multi_threaded_global::get_mutex() {
+ static pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
+ return &g_mutex;
}
#endif // _SIGSLOT_HAS_POSIX_THREADS
-}; // namespace sigslot
+} // namespace sigslot

Powered by Google App Engine
This is Rietveld 408576698