big merge

This commit is contained in:
Philippe G
2021-12-18 21:04:23 -08:00
parent 955692f8ad
commit 898998efb0
583 changed files with 84472 additions and 1965 deletions

View File

@@ -0,0 +1,36 @@
#ifndef UNIXLIKE_WRAPPED_MUTEX_H
#define UNIXLIKE_WRAPPED_MUTEX_H
#include <pthread.h>
/**
* Wraps a mutex on unixlike patforms (linux, macOS, esp32 etc.).
* Header only since all the methods call one function, we want them to be inlined
**/
class WrappedMutex
{
public:
WrappedMutex()
{
pthread_mutex_init(&this->_mutex, NULL);
}
~WrappedMutex()
{
pthread_mutex_destroy(&this->_mutex);
}
void lock()
{
pthread_mutex_lock(&this->_mutex);
}
void unlock()
{
pthread_mutex_unlock(&this->_mutex);
}
private:
pthread_mutex_t _mutex;
};
#endif