equal
deleted
inserted
replaced
17 * |
17 * |
18 * Author: Mathieu Lacage <mathieu.lacage.inria.fr> |
18 * Author: Mathieu Lacage <mathieu.lacage.inria.fr> |
19 */ |
19 */ |
20 |
20 |
21 #include <pthread.h> |
21 #include <pthread.h> |
22 #include <string.h> |
22 #include <cstring> |
23 #include <errno.h> |
23 #include <cerrno> // for strerror |
|
24 |
24 #include "fatal-error.h" |
25 #include "fatal-error.h" |
25 #include "system-mutex.h" |
26 #include "system-mutex.h" |
26 #include "log.h" |
27 #include "log.h" |
|
28 |
27 |
29 |
28 NS_LOG_COMPONENT_DEFINE ("SystemMutex"); |
30 NS_LOG_COMPONENT_DEFINE ("SystemMutex"); |
29 |
31 |
30 namespace ns3 { |
32 namespace ns3 { |
31 |
33 |
77 int rc = pthread_mutex_lock (&m_mutex); |
79 int rc = pthread_mutex_lock (&m_mutex); |
78 if (rc != 0) |
80 if (rc != 0) |
79 { |
81 { |
80 NS_FATAL_ERROR ("SystemMutexPrivate::Lock()" |
82 NS_FATAL_ERROR ("SystemMutexPrivate::Lock()" |
81 "pthread_mutex_lock failed: " << rc << " = \"" << |
83 "pthread_mutex_lock failed: " << rc << " = \"" << |
82 strerror (rc) << "\""); |
84 std::strerror (rc) << "\""); |
83 } |
85 } |
84 } |
86 } |
85 |
87 |
86 void |
88 void |
87 SystemMutexPrivate::Unlock (void) |
89 SystemMutexPrivate::Unlock (void) |
91 int rc = pthread_mutex_unlock (&m_mutex); |
93 int rc = pthread_mutex_unlock (&m_mutex); |
92 if (rc != 0) |
94 if (rc != 0) |
93 { |
95 { |
94 NS_FATAL_ERROR ("SystemMutexPrivate::Unlock()" |
96 NS_FATAL_ERROR ("SystemMutexPrivate::Unlock()" |
95 "pthread_mutex_unlock failed: " << rc << " = \"" << |
97 "pthread_mutex_unlock failed: " << rc << " = \"" << |
96 strerror (rc) << "\""); |
98 std::strerror (rc) << "\""); |
97 } |
99 } |
98 } |
100 } |
99 |
101 |
100 SystemMutex::SystemMutex() |
102 SystemMutex::SystemMutex() |
101 : m_priv (new SystemMutexPrivate ()) |
103 : m_priv (new SystemMutexPrivate ()) |