Added a mutex class.

This commit is contained in:
Relintai 2021-11-09 19:38:07 +01:00
parent ec65de456d
commit c94c465d78
3 changed files with 35 additions and 0 deletions

View File

@ -13,6 +13,7 @@ env.add_source_files(env.core_sources, "./hash/*.cpp")
env.add_source_files(env.core_sources, "./bry_http/*.cpp")
env.add_source_files(env.core_sources, "./database/*.cpp")
env.add_source_files(env.core_sources, "./os/*.cpp")
env.add_source_files(env.core_sources, "./threading/*.cpp")
# Build it all as a library
lib = env.add_library("core", env.core_sources)

15
core/threading/mutex.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "mutex.h"
void Mutex::lock() {
_mutex.lock();
}
void Mutex::unlock() {
_mutex.unlock();
}
Mutex::Mutex() {
}
Mutex::~Mutex() {
}

19
core/threading/mutex.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef MUTEX_H
#define MUTEX_H
#include <mutex>
class Mutex {
public:
void lock();
void unlock();
Mutex();
virtual ~Mutex();
protected:
std::mutex _mutex;
};
#endif