public void CloseMe(RThread thread) { if (thread.Id != null) { lock (Threads) Threads.Remove(thread.Id); } GC.Collect(0, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); }
public void ExecuteGeneralTicks(Action action, int ticks, int tickWait = 1000, int wait = 0, object id = null) { RThread thread = new RThread { Type = RThreadType.GeneralTick, Id = id, StartWait = wait, PerformAction = action, Ticks = ticks, TickSleep = tickWait }; if (id != null) { Threads.Add(thread.Id, thread); } thread.Start(); }
public void ExecuteActions(Action[] actions, int tickWait = 1000, int wait = 0, object id = null) { RThread thread = new RThread { Type = RThreadType.Actions, Id = id, StartWait = wait, PerformActions = actions, Ticks = actions.Length, TickSleep = tickWait }; if (id != null) { Threads.Add(thread.Id, thread); } thread.Start(); }
public void ExecuteGeneral(Action action, int wait = 0, object id = null) { RThread thread = new RThread { Type = RThreadType.General, Id = id, StartWait = wait, PerformAction = action }; if (id != null) { Threads.Add(thread.Id, thread); } thread.Start(); Log.Info($"threads {Threads.Count}"); }