ladybird/Libraries/LibCore/CThread.h
Andreas Kling f1d6a37d5d LibCore: Add CThread, a simple thread abstraction object.
Currently this is only a simple wrapper around create_thread() that
remembers the thread ID of the spawned thread.
2019-07-14 10:19:51 +02:00

19 lines
371 B
C++

#pragma once
class CThread {
public:
static CThread& main_thread();
CThread(int (*entry)(void*), void* user_data);
~CThread();
bool is_main_thread() const { return m_thread_id == 0; }
int thread_id() const { return m_thread_id; }
private:
enum MainThreadTag { MainThread };
explicit CThread(MainThreadTag);
int m_thread_id { -1 };
};