#include <Windows.h> class sprawl::threading::Handle { public: Handle() : m_thread() , duplicate(false) { // } Handle(HANDLE const& thread) : m_thread(nullptr) , duplicate(true) { DuplicateHandle(GetCurrentProcess(), thread, GetCurrentProcess(), &m_thread, 0, false, DUPLICATE_SAME_ACCESS); } Handle(Handle const& other) : m_thread(other.m_thread) , duplicate(false) { } ~Handle() { if(duplicate) { CloseHandle(m_thread); } } bool operator==(Handle const& other) const { return m_thread == other.m_thread; } bool operator!=(Handle const& other) const { return m_thread != other.m_thread; } int64_t GetUniqueId() const; HANDLE& GetNativeHandle() { return m_thread; } HANDLE const& GetNativeHandle() const { return m_thread; } private: HANDLE m_thread; bool duplicate; };
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 14148 | ShadauxCat |
Fixed thread handle equality check not being const qualified, checks in thread unit test not using gtest macros #review-14149 |
||
#1 | 13650 | ShadauxCat |
- Windows implementations of thread and time libraries - Added coroutines - Added some more unit tests, fixed some unit tests in windows environments - Fixed an issue where multi threading was not properly detected on Linux - Fixed the makefiles to build with threading by default on linux - Changed the pool allocator to use thread-local pools instead of locking mutexes - Fixed output of sprawl::string in the StringBuilder library to take length into account - Added string builder options for StringLiteral - Added thread local implementation #review |