Beispiel #1
0
        public void CloseMe(RThread thread)
        {
            if (thread.Id != null)
            {
                lock (Threads)
                    Threads.Remove(thread.Id);
            }

            GC.Collect(0, GCCollectionMode.Forced);
            GC.WaitForPendingFinalizers();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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}");
        }