mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Use C++11 mutexes only (remove compat code) (#5922)
* Fix event LINT & remove default constructor/destructors * remove compat code & modernize autolock header
This commit is contained in:
parent
8bdde45895
commit
d4c0f91275
36 changed files with 59 additions and 363 deletions
|
@ -28,11 +28,8 @@ DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include "threads.h"
|
||||
|
||||
#if USE_CPP11_MUTEX
|
||||
#include <condition_variable>
|
||||
#include "threading/mutex.h"
|
||||
#include "threading/mutex_auto_lock.h"
|
||||
#endif
|
||||
|
||||
/** A syncronization primitive that will wake up one waiting thread when signaled.
|
||||
* Calling @c signal() multiple times before a waiting thread has had a chance
|
||||
|
@ -43,25 +40,13 @@ DEALINGS IN THE SOFTWARE.
|
|||
class Event
|
||||
{
|
||||
public:
|
||||
Event();
|
||||
#ifndef USE_CPP11_MUTEX
|
||||
~Event();
|
||||
#endif
|
||||
void wait();
|
||||
void signal();
|
||||
|
||||
private:
|
||||
#if USE_CPP11_MUTEX
|
||||
std::condition_variable cv;
|
||||
Mutex mutex;
|
||||
bool notified;
|
||||
#elif USE_WIN_MUTEX
|
||||
HANDLE event;
|
||||
#else
|
||||
pthread_cond_t cv;
|
||||
pthread_mutex_t mutex;
|
||||
bool notified;
|
||||
#endif
|
||||
std::mutex mutex;
|
||||
bool notified = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue