Report a bug
		
				If you spot a problem with this page, click here to create a Bugzilla issue.
		
			Improve this page
		
			Quickly fork, edit online, and submit a pull request for this page.
			Requires a signed-in GitHub account. This works well for small changes.
			If you'd like to make larger changes you may want to consider using
			a local clone.
		
	core.thread.threadgroup
The osthread module provides types used in threads modules.
License: 
Distributed under the
      Boost Software License 1.0.
    (See accompanying file LICENSE)
Authors: 
Sean Kelly, Walter Bright, Alex Rønne Petersen, Martin Nowak
Source core/thread/threadgroup.d
- classThreadGroup;
- This class is intended to simplify certain common programming techniques.- final Threadcreate(void function()fn);
- Creates and starts a new Thread object that executes fn and adds it to the list of tracked threads.Parameters:void function() fnThe thread function. Returns:A reference to the newly created thread.
- final Threadcreate(void delegate()dg);
- Creates and starts a new Thread object that executes dg and adds it to the list of tracked threads.Parameters:void delegate() dgThe thread function. Returns:A reference to the newly created thread.
- final voidadd(Threadt);
- Add t to the list of tracked threads if it is not already being tracked.Parameters:Thread tThe thread to add. In t must not be null. 
- final voidremove(Threadt);
- Removes t from the list of tracked threads. No operation will be performed if t is not currently being tracked by this object.Parameters:Thread tThe thread to remove. In t must not be null. 
- final intopApply(scope int delegate(ref Thread)dg);
- Operates on all threads currently tracked by this object.
- final voidjoinAll(boolrethrow= true);
- Iteratively joins all tracked threads. This function will block add, remove, and opApply until it completes.Parameters:bool rethrowRethrow any unhandled exception which may have caused the current thread to terminate. Throws:Any exception not handled by the joined threads.
 
Copyright © 1999-2025 by the D Language Foundation | Page generated by
Ddoc on Mon Mar 31 10:28:06 2025