| OLD | NEW |
| 1 // sigslot.h: Signal/Slot classes | 1 // sigslot.h: Signal/Slot classes |
| 2 // | 2 // |
| 3 // Written by Sarah Thompson (sarah@telergy.com) 2002. | 3 // Written by Sarah Thompson (sarah@telergy.com) 2002. |
| 4 // | 4 // |
| 5 // License: Public domain. You are free to use this code however you like, with | 5 // License: Public domain. You are free to use this code however you like, with |
| 6 // the proviso that the author takes on no responsibility or liability for any | 6 // the proviso that the author takes on no responsibility or liability for any |
| 7 // use. | 7 // use. |
| 8 | 8 |
| 9 #include "webrtc/base/sigslot.h" | 9 #include "webrtc/base/sigslot.h" |
| 10 | 10 |
| 11 namespace sigslot { | 11 namespace sigslot { |
| 12 | 12 |
| 13 #ifdef _SIGSLOT_HAS_POSIX_THREADS | 13 #ifdef _SIGSLOT_HAS_POSIX_THREADS |
| 14 | 14 |
| 15 multi_threaded_global::multi_threaded_global() { | 15 multi_threaded_global::multi_threaded_global() { |
| 16 pthread_mutex_init(get_mutex(), NULL); | 16 pthread_mutex_init(get_mutex(), nullptr); |
| 17 } | 17 } |
| 18 | 18 |
| 19 multi_threaded_global::multi_threaded_global(const multi_threaded_global&) { | 19 multi_threaded_global::multi_threaded_global(const multi_threaded_global&) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 multi_threaded_global::~multi_threaded_global() = default; | 22 multi_threaded_global::~multi_threaded_global() = default; |
| 23 | 23 |
| 24 void multi_threaded_global::lock() { | 24 void multi_threaded_global::lock() { |
| 25 pthread_mutex_lock(get_mutex()); | 25 pthread_mutex_lock(get_mutex()); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void multi_threaded_global::unlock() { | 28 void multi_threaded_global::unlock() { |
| 29 pthread_mutex_unlock(get_mutex()); | 29 pthread_mutex_unlock(get_mutex()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 multi_threaded_local::multi_threaded_local() { | 32 multi_threaded_local::multi_threaded_local() { |
| 33 pthread_mutex_init(&m_mutex, NULL); | 33 pthread_mutex_init(&m_mutex, nullptr); |
| 34 } | 34 } |
| 35 | 35 |
| 36 multi_threaded_local::multi_threaded_local(const multi_threaded_local&) { | 36 multi_threaded_local::multi_threaded_local(const multi_threaded_local&) { |
| 37 pthread_mutex_init(&m_mutex, NULL); | 37 pthread_mutex_init(&m_mutex, nullptr); |
| 38 } | 38 } |
| 39 | 39 |
| 40 multi_threaded_local::~multi_threaded_local() { | 40 multi_threaded_local::~multi_threaded_local() { |
| 41 pthread_mutex_destroy(&m_mutex); | 41 pthread_mutex_destroy(&m_mutex); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void multi_threaded_local::lock() { | 44 void multi_threaded_local::lock() { |
| 45 pthread_mutex_lock(&m_mutex); | 45 pthread_mutex_lock(&m_mutex); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void multi_threaded_local::unlock() { | 48 void multi_threaded_local::unlock() { |
| 49 pthread_mutex_unlock(&m_mutex); | 49 pthread_mutex_unlock(&m_mutex); |
| 50 } | 50 } |
| 51 | 51 |
| 52 #endif // _SIGSLOT_HAS_POSIX_THREADS | 52 #endif // _SIGSLOT_HAS_POSIX_THREADS |
| 53 | 53 |
| 54 }; // namespace sigslot | 54 }; // namespace sigslot |
| OLD | NEW |