/// <summary> /// Add an action to be run on the task machine completing. /// </summary> public void AddOnDone(Action action) { _lock.Take(); _onDone.Add(action); _lock.Release(); }