module watt.process.group

Launch and manage multiple processes.

Code Map

//! Launch and manage multiple processes.
module watt.process.group;


//! Helper class to launch one or more processes to run along side the main
//! process.
class Group
{
public:
	//! Is called with the retval of the completed command.
	alias DoneDg = void delegate(i32);


public:
	this(maxWaiting: u32) { }
	fn run(name: string, args: string[], done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputStream: InputStdcStream, outputStream: OutputStdcStream, errorStream: OutputStdcStream, env: Environment, done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputStream: FILE*, outputStream: FILE*, errorStream: FILE*, env: Environment, done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputStream: InputFDStream, outputStream: OutputFDStream, errorStream: OutputFDStream, env: Environment, done: DoneDg) Pid { }
	fn run(name: string, args: string[], inputFD: i32, outputFD: i32, errorFD: i32, env: Environment, done: DoneDg) Pid { }
	fn waitOne() { }
	//! Wait for all currently dispatched processes to complete.
	fn waitAll() { }
}
class Group

Helper class to launch one or more processes to run along side the main process.

alias DoneDg

Is called with the retval of the completed command.

cmdStore: Cmd[]

All commands, commands are reused.

maxWaiting: u32

Number of simultanious jobs.

waiting: u32

Number of running jobs at this moment.

class Cmd

Small container representing a executed command, is recycled.

done: DoneDg

Called when command has completed, with the return code.

handle: Pid.OsHandle

System specific process handle.

used: bool

In use.

fn set(dgt: DoneDg, handle: Pid.OsHandle)

Initialize all the fields.

fn reset()

Reset to a unused state.

fn waitAll()

Wait for all currently dispatched processes to complete.