Commit 77d93d70 authored by Martin Hurton's avatar Martin Hurton

Simplify use of posix_assert in mutex.hpp

It is the job of the posix_assert macro to check
the value. No need to do it twice.

The patch also fixes some whitespace problems.
parent e7674025
......@@ -74,47 +74,43 @@ namespace zmq
namespace zmq
{
class mutex_t
{
public:
inline mutex_t ()
{
int rc = pthread_mutex_init (&mutex, NULL);
if (rc)
posix_assert (rc);
posix_assert (rc);
}
inline ~mutex_t ()
{
int rc = pthread_mutex_destroy (&mutex);
if (rc)
posix_assert (rc);
posix_assert (rc);
}
inline void lock ()
{
int rc = pthread_mutex_lock (&mutex);
if (rc)
posix_assert (rc);
posix_assert (rc);
}
inline void unlock ()
{
int rc = pthread_mutex_unlock (&mutex);
if (rc)
posix_assert (rc);
posix_assert (rc);
}
private:
pthread_mutex_t mutex;
// Disable copy construction and assignment.
mutex_t (const mutex_t&);
const mutex_t &operator = (const mutex_t&);
};
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment