MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / Thread

Class Thread

common/Threading.h:93–125  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Thread -------------------------------------------------------------------------------------- Abstracts a native thread in a lightweight manner. Provides more functionality than std::thread (allowing stack size adjustments).

Source from the content-addressed store, hash-verified

91 // std::thread (allowing stack size adjustments).
92 //
93 class Thread : public ThreadHandle
94 {
95 public:
96 using EntryPoint = std::function<void()>;
97
98 Thread();
99 Thread(Thread&& thread);
100 Thread(const Thread&) = delete;
101 Thread(EntryPoint func);
102 ~Thread();
103
104 ThreadHandle& operator=(Thread&& thread);
105 ThreadHandle& operator=(const Thread& handle) = delete;
106
107 __fi bool Joinable() const { return (m_native_handle != nullptr); }
108 __fi u32 GetStackSize() const { return m_stack_size; }
109
110 /// Sets the stack size for the thread. Do not call if the thread has already been started.
111 void SetStackSize(u32 size);
112
113 bool Start(EntryPoint func);
114 void Detach();
115 void Join();
116
117 protected:
118#ifdef _WIN32
119 static unsigned __stdcall ThreadProc(void* param);
120#else
121 static void* ThreadProc(void* param);
122#endif
123
124 u32 m_stack_size = 0;
125 };
126
127 /// A semaphore that may not have a fast userspace path
128 /// (Used in other semaphore-based algorithms where the semaphore is just used for its thread sleep/wake ability)

Callers 4

pcsx2-qt_de-DE.tsFile · 0.85
LnxThreads.cppFile · 0.85
DarwinThreads.cppFile · 0.85
WinThreads.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected