Plasma Engine  2.0
Loading...
Searching...
No Matches
OSThread.h
1#pragma once
2
3#include <Foundation/Basics.h>
4#include <Foundation/Strings/String.h>
5#include <Foundation/Threading/AtomicInteger.h>
6#include <Foundation/Threading/Implementation/ThreadingDeclarations.h>
7
12class PL_FOUNDATION_DLL plOSThread
13{
14public:
19 plOSThread(plOSThreadEntryPoint threadEntryPoint, void* pUserData = nullptr, plStringView sName = "plOSThread", plUInt32 uiStackSize = 128 * 1024);
20
22 virtual ~plOSThread();
23
25 void Start(); // [tested]
26
28 void Join(); // [tested]
29
32 const plThreadID& GetThreadID() const { return m_ThreadID; }
33
35 static plInt32 GetThreadCount() { return s_iThreadCount; }
36
37protected:
38 plThreadHandle m_hHandle;
39 plThreadID m_ThreadID;
40
41 plOSThreadEntryPoint m_EntryPoint;
42
43 void* m_pUserData;
44
45 plString m_sName;
46
47 plUInt32 m_uiStackSize;
48
49
50private:
52 static plAtomicInteger32 s_iThreadCount;
53
54 PL_DISALLOW_COPY_AND_ASSIGN(plOSThread);
55};
Implementation of a thread.
Definition OSThread.h:13
const plThreadID & GetThreadID() const
Returns the thread ID of the thread object, may be used in comparison operations with plThreadUtils::...
Definition OSThread.h:32
static plInt32 GetThreadCount()
Returns how many plOSThreads are currently active.
Definition OSThread.h:35
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34