xtd 0.2.0
Loading...
Searching...
No Matches
xtd::native::thread Class Referencefinal

Definition

Contains thread native API.

Namespace
xtd::native
Library
xtd.core.native
Warning
Internal use only

Protected Static Methods

static bool cancel (intmax_t handle)
 Cancel thread with specified handle.
 
static intmax_t create (std::function< void(intmax_t)> start, intmax_t obj, int32_t max_stack_size, bool suspended, intmax_t &id)
 Cancel thread with specified handle.
 
static bool detach (intmax_t handle)
 Detach thread with specified handle.
 
static intmax_t get_current_thread_handle ()
 Gets the current thread handle.
 
static intmax_t get_thread_id (intmax_t handle)
 Gets the thread id.
 
static bool join (intmax_t handle)
 Join thread with specified handle.
 
static bool resume (intmax_t handle)
 Resume thread with specified handle.
 
static bool set_current_thread_name (const std::string &name)
 Sets the current thread name.
 
static bool set_priority (intmax_t handle, int32_t priority)
 Sets the thread priority.
 
static void sleep (int32_t milliseconds_timeout)
 Suspends the current thread for a specified time.
 
static bool suspend (intmax_t handle)
 Suspend thread with specified handle.
 
static bool yield ()
 Causes the calling thread to yield execution to another thread that is ready to run on the current processor.
 

Member Function Documentation

◆ cancel()

static bool xtd::native::thread::cancel ( intmax_t  handle)
staticprotected

Cancel thread with specified handle.

Parameters
handleThe thread handle.
Returns
true if succeed; otherwise false.
Warning
Internal use only

◆ create()

static intmax_t xtd::native::thread::create ( std::function< void(intmax_t)>  start,
intmax_t  obj,
int32_t  max_stack_size,
bool  suspended,
intmax_t &  id 
)
staticprotected

Cancel thread with specified handle.

Parameters
startThe function to run in the new thread created.
objThe argument of the start function.
max_stack_sizeThe maximum stack size, in bytes, to be used by the thread, or 0 to use the default maximum stack size specified in the header for the executable.
Returns
The thread handle.
Warning
Internal use only

◆ detach()

static bool xtd::native::thread::detach ( intmax_t  handle)
staticprotected

Detach thread with specified handle.

Parameters
handleThe thread handle.
Returns
true if succeed; otherwise false.
Warning
Internal use only

◆ get_current_thread_handle()

static intmax_t xtd::native::thread::get_current_thread_handle ( )
staticprotected

Gets the current thread handle.

Returns
The current thread handle.
Warning
Internal use only

◆ get_thread_id()

static intmax_t xtd::native::thread::get_thread_id ( intmax_t  handle)
staticprotected

Gets the thread id.

Parameters
handleThe thread handle.
Returns
The current thread id.
Warning
Internal use only

◆ join()

static bool xtd::native::thread::join ( intmax_t  handle)
staticprotected

Join thread with specified handle.

Parameters
handleThe thread handle.
Returns
true if succeed; otherwise false.
Warning
Internal use only

◆ resume()

static bool xtd::native::thread::resume ( intmax_t  handle)
staticprotected

Resume thread with specified handle.

Parameters
handleThe thread handle.
Returns
true if succeed; otherwise false.
Warning
Internal use only

◆ set_current_thread_name()

static bool xtd::native::thread::set_current_thread_name ( const std::string &  name)
staticprotected

Sets the current thread name.

Parameters
nameThe current thread name.
Returns
true if succeed; otherwise false.
Warning
Internal use only

◆ set_priority()

static bool xtd::native::thread::set_priority ( intmax_t  handle,
int32_t  priority 
)
staticprotected

Sets the thread priority.

Parameters
handleThe thread handle.
priorityThe thread priority.
Returns
true if succeed; otherwise false.
Warning
Internal use only
Remarks
Possible values for priority paramter :
  • 0 : lowest
  • 1 : below_normal
  • 2 : normal
  • 3 : above_normal
  • 4 : highest

◆ sleep()

static void xtd::native::thread::sleep ( int32_t  milliseconds_timeout)
staticprotected

Suspends the current thread for a specified time.

Parameters
milliseconds_timeoutThe number of milliseconds for which the thread is blocked. Specify zero (0) to indicate that this thread should be suspended to allow other waiting threads to execute. Specify -1 to block the thread indefinitely.
Returns
true if succeed; otherwise false.
Warning
Internal use only

◆ suspend()

static bool xtd::native::thread::suspend ( intmax_t  handle)
staticprotected

Suspend thread with specified handle.

Parameters
handleThe thread handle.
Returns
true if succeed; otherwise false.
Warning
Internal use only

◆ yield()

static bool xtd::native::thread::yield ( )
staticprotected

Causes the calling thread to yield execution to another thread that is ready to run on the current processor.

Returns
true if succeed; otherwise false.
Warning
Internal use only

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