fix deadlock

This commit is contained in:
InoriRus
2022-01-19 17:24:34 +10:00
parent 8ee51a2756
commit ce0fcf9cab
4 changed files with 470 additions and 207 deletions
+6 -4
View File
@@ -10,7 +10,9 @@ KYTY_SUBSYSTEM_DEFINE(Threads);
using thread_func_t = void (*)(void*);
// struct ThreadPrivate;
struct ThreadPrivate;
struct MutexPrivate;
struct CondVarPrivate;
class String;
class Thread
@@ -25,6 +27,9 @@ public:
// Once a thread has finished, the id may be reused by another thread.
[[nodiscard]] String GetId() const;
// The id is unique and can't be reused by another thread.
[[nodiscard]] int GetUniqueId() const;
static void Sleep(uint32_t millis);
static void SleepMicro(uint32_t micros);
static void SleepNano(uint64_t nanos);
@@ -41,7 +46,6 @@ public:
KYTY_CLASS_NO_COPY(Thread);
private:
struct ThreadPrivate;
ThreadPrivate* m_thread;
};
@@ -60,7 +64,6 @@ public:
KYTY_CLASS_NO_COPY(Mutex);
private:
struct MutexPrivate;
MutexPrivate* m_mutex;
};
@@ -97,7 +100,6 @@ public:
KYTY_CLASS_NO_COPY(CondVar);
private:
struct CondVarPrivate;
CondVarPrivate* m_cond_var;
};