Electroneum
Loading...
Searching...
No Matches
el::base::threading::internal::Mutex Class Reference

A mutex wrapper for compiler that dont yet support std::recursive_mutex. More...

#include <easylogging++.h>

Inheritance diagram for el::base::threading::internal::Mutex:
Collaboration diagram for el::base::threading::internal::Mutex:

Public Member Functions

 Mutex (void)
virtual ~Mutex (void)
void lock (void)
bool try_lock (void)
void unlock (void)

Detailed Description

A mutex wrapper for compiler that dont yet support std::recursive_mutex.

Definition at line 914 of file easylogging++.h.

Constructor & Destructor Documentation

◆ Mutex()

el::base::threading::internal::Mutex::Mutex ( void )
inline

Definition at line 916 of file easylogging++.h.

916 {
917# if ELPP_OS_UNIX
918 pthread_mutexattr_t attr;
919 pthread_mutexattr_init(&attr);
920 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
921 pthread_mutex_init(&m_underlyingMutex, &attr);
922 pthread_mutexattr_destroy(&attr);
923# elif ELPP_OS_WINDOWS
924 InitializeCriticalSection(&m_underlyingMutex);
925# endif // ELPP_OS_UNIX
926 }

◆ ~Mutex()

virtual el::base::threading::internal::Mutex::~Mutex ( void )
inlinevirtual

Definition at line 928 of file easylogging++.h.

928 {
929# if ELPP_OS_UNIX
930 pthread_mutex_destroy(&m_underlyingMutex);
931# elif ELPP_OS_WINDOWS
932 DeleteCriticalSection(&m_underlyingMutex);
933# endif // ELPP_OS_UNIX
934 }

Member Function Documentation

◆ lock()

void el::base::threading::internal::Mutex::lock ( void )
inline

Definition at line 936 of file easylogging++.h.

936 {
937# if ELPP_OS_UNIX
938 pthread_mutex_lock(&m_underlyingMutex);
939# elif ELPP_OS_WINDOWS
940 EnterCriticalSection(&m_underlyingMutex);
941# endif // ELPP_OS_UNIX
942 }

◆ try_lock()

bool el::base::threading::internal::Mutex::try_lock ( void )
inline

Definition at line 944 of file easylogging++.h.

944 {
945# if ELPP_OS_UNIX
946 return (pthread_mutex_trylock(&m_underlyingMutex) == 0);
947# elif ELPP_OS_WINDOWS
948 return TryEnterCriticalSection(&m_underlyingMutex);
949# endif // ELPP_OS_UNIX
950 }

◆ unlock()

void el::base::threading::internal::Mutex::unlock ( void )
inline

Definition at line 952 of file easylogging++.h.

952 {
953# if ELPP_OS_UNIX
954 pthread_mutex_unlock(&m_underlyingMutex);
955# elif ELPP_OS_WINDOWS
956 LeaveCriticalSection(&m_underlyingMutex);
957# endif // ELPP_OS_UNIX
958 }

The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/external/easylogging++/easylogging++.h