License
Distributed under the
Boost Software License 1.0.
(See accompanying file LICENSE)
The osthread module provides low-level, OS-dependent code for thread creation and management.
(See accompanying file LICENSE)
This class encapsulates all threading functionality for the D programming language. As thread manipulation is a required facility for garbage collection, all user threads should derive from this class, and instances of this class should never be explicitly deleted. A new thread may be created using either derivation or composition, as in the following example.
void run()Thread start() nothrowStarts the thread and invokes the function or delegate passed upon construction.Throwable join( bool rethrow = true )Waits for this thread to complete. If the thread terminated as the result of an unhandled exception, this exception will be rethrown.this( void function() fn, size_t sz = 0 )Initializes a thread object which is associated with a static D function.this( void delegate() dg, size_t sz = 0 )Initializes a thread object which is associated with a dynamic D function.this( size_t sz = 0 )~thisCleans up any remaining resources used by this object.void * _d_eh_swapContext(void * newContext) nothrow @nogcHook for whatever EH implementation is used to save/restore some data per stack.Thread thread_attachThis()Registers the calling thread for use with the D Runtime. If this routine is called for a thread which is already registered, no action is performed.bool suspend( Thread t ) nothrow @nogcSuspend the specified thread and load stack and register information for use by thread_scanAll. If the supplied thread is the calling thread, stack and register information will be loaded but the ...void thread_preStopTheWorld() nothrowRuns the necessary operations required before stopping the world.void thread_suspendAll() nothrowSuspend all threads but the calling thread for "stop the world" garbage collection runs. This function may be called multiple times, and must be followed by a matching number of calls to thread_re...void resume(ThreadBase _t) nothrow @nogcResume the specified thread and unload stack and register information. If the supplied thread is the calling thread, stack and register information will be unloaded but the thread will not be resum...void thread_init() @nogc nothrowInitializes the thread module. This function must be called by the garbage collector on startup and before any other thread routines are called.void thread_term() @nogc nothrowTerminates the thread module. No other thread routine may be called afterwards.void rt_moduleTlsCtor()void rt_moduleTlsDtor()ThreadID createLowLevelThread(void delegate() nothrow dg, uint stacksize = 0,
void delegate() nothrow cbDllUnload = null) nothrow @nogcCreate a thread not under control of the runtime, i.e. TLS module constructors are not run and the GC does not suspend it during a collection.void joinLowLevelThread(ThreadID tid) nothrow @nogcWait for a thread created with `createLowLevelThread` to terminate.MainThreadStore _mainThreadStorebool thread_DLLProcessDetachingset during termination of a DLL on Windows, i.e. while executing DllMain(DLL_PROCESS_DETACH)
HMODULE ll_dllModuleThreadID ll_dllMonitorThread