xtd 0.2.0
Loading...
Searching...
No Matches

◆ is_background() [1/2]

bool xtd::threading::thread::is_background ( ) const
noexcept

Gets a value indicating whether or not a thread is a background thread.

Returns
true if this thread is or is to become a background thread; otherwise, false.
Exceptions
xtd::threadng::thread_state_exceptionThe thread is dead.
Remarks
A thread is either a background thread or a foreground thread. Background threads are identical to foreground threads, except that background threads do not prevent a process from terminating. Once all foreground threads belonging to a process have terminated, the system ends the process. Any remaining background threads are stopped and do not complete.
By default, the following threads execute in the foreground (that is, their xtd::threading::thread::is_background property returns false):
  • The primary thread (or main application thread).
  • All threads created by calling a xtd::threading::thread class constructor.
By default, the following threads execute in the background (that is, their xtd::threading::thread::is_background property returns true):
  • Thread pool threads, which are a pool of worker threads maintained by the runtime. You can configure the thread pool and schedule work on thread pool threads by using the xtd::threading::thread_pool class.
  • All threads create without xtd::threading::thread class (std::thread or threads create by oparating system API).