28 #include <SFML/System/Win32/Thread.hpp>
78 myHandle =
reinterpret_cast<HANDLE
>(_beginthreadex(NULL, 0, &Thread::ThreadFunc,
this, 0, NULL));
82 std::cerr <<
"Failed to create thread" << std::endl;
94 WaitForSingleObject(myHandle, INFINITE);
97 CloseHandle(myHandle);
113 TerminateThread(myHandle, 0);
125 myFunction(myUserData);
132 unsigned int __stdcall Thread::ThreadFunc(
void* UserData)
135 Thread* ThreadInstance =
reinterpret_cast<Thread*
>(UserData);
138 ThreadInstance->Run();
void Wait()
Wait until the thread finishes.
virtual ~Thread()
Virtual destructor.
Thread()
Default constructor.
void Launch()
Create and run the thread.
void Terminate()
Terminate the thread Terminating a thread with this function is not safe, you should rather try to ma...