U3D
Open-source, cross-platform 2D and 3D game engine built in C++
Loading...
Searching...
No Matches
Urho3D::Thread Class Referenceabstract

Operating system thread. More...

#include </var/dev/u3d/stable/Source/Urho3D/Core/Thread.h>

Inheritance diagram for Urho3D::Thread:
[legend]

Public Member Functions

 Thread ()
 Construct. Does not start the thread yet.
 
virtual ~Thread ()
 Destruct. If running, stop and wait for thread to finish.
 
virtual void ThreadFunction ()=0
 The function to run in the thread. More...
 
bool Run ()
 Start running the thread. Return true if successful, or false if already running or if can not create the thread.
 
void Stop ()
 Set the running flag to false and wait for the thread to finish.
 
void SetPriority (int priority)
 Set thread priority. The thread must have been started first.
 
bool IsStarted () const
 Return whether thread exists.
 

Static Public Member Functions

static void SetMainThread ()
 Set the current thread as the main thread.
 
static ThreadID GetCurrentThreadID ()
 
static bool IsMainThread ()
 Return whether is executing in the main thread.
 

Protected Attributes

void * handle_
 Thread handle.
 
volatile bool shouldRun_
 Running flag.
 

Static Protected Attributes

static ThreadID mainThreadID
 Main thread's thread ID.
 

Detailed Description

Operating system thread.

Member Function Documentation

◆ GetCurrentThreadID()

ThreadID Urho3D::Thread::GetCurrentThreadID ( )
static

Return the current thread's ID.

Here is the caller graph for this function:

◆ ThreadFunction()

virtual void Urho3D::Thread::ThreadFunction ( )
pure virtual

The function to run in the thread.

Implemented in Urho3D::FileWatcher, Urho3D::HttpRequest, and Urho3D::BackgroundLoader.


The documentation for this class was generated from the following files: