1 /** 2 * Defines some useful helpers for running the engine concurrently. 3 */ 4 module dash.utility.concurrency; 5 6 public import core.thread, std.concurrency, std.parallelism; 7 8 /// The ID of the main thread 9 @property Tid mainThread() { return cast()_mainThread; } 10 /// Returns true if called by main thread 11 @property bool onMainThread() { return thisTid == mainThread; } 12 13 shared static this() 14 { 15 _mainThread = cast(shared)thisTid; 16 } 17 18 private shared Tid _mainThread;