Exemplo n.º 1
0
        public void Start()
        {
            ThreadFunction fun = Functions.Find(e => e == Function);

            if (fun == null)
            {
                Functions.Add(Function);
                Function(0);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Führt eine Funktion in einem eigenen Thread aus und übergibt einen eigenen, optionalen Parameter
        /// </summary>
        /// <param name="function">Die Funktion die im eigenen Thread laufen soll</param>
        /// <param name="args">(Optional) Der zu übergebene Parameter.</param>
        public static void RunAsThread(ThreadFunction function, object args = null)
        {
            ThreadEvents.Add(new ManualResetEvent(false));

            int id = ThreadEvents.Count - 1;

            object[] pArgs = new object[3];
            pArgs[0] = function;
            pArgs[1] = args;
            pArgs[2] = id;

            ThreadPool.QueueUserWorkItem(RunThreadFunc, pArgs);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Führt eine Funktion in einem eigenen Thread aus und übergibt einen eigenen, optionalen Parameter
        /// </summary>
        /// <param name="function">Die Funktion die im eigenen Thread laufen soll</param>
        /// <param name="args">(Optional) Der zu übergebene Parameter.</param>
        public static void RunAsThread(ThreadFunction function, object args = null)
        {
            ThreadEvents.Add(new ManualResetEvent(false));

            int id = ThreadEvents.Count - 1;

            object[] pArgs = new object[3];
            pArgs[0] = function;
            pArgs[1] = args;
            pArgs[2] = id;

            ThreadPool.QueueUserWorkItem(RunThreadFunc, pArgs);
        }
Exemplo n.º 4
0
 public AnimationThread(ThreadFunction tf)
 {
     this.WorkerSupportsCancellation = true;
     this.DoWork += new System.ComponentModel.DoWorkEventHandler(this.this_DoWork);
     _tf = tf;
 }
Exemplo n.º 5
0
 public AnimationThread(ThreadFunction threadFunction)
 {
     WorkerSupportsCancellation = true;
     DoWork         += new DoWorkEventHandler(this_DoWork);
     _threadFunction = threadFunction;
 }
Exemplo n.º 6
0
 public AnimationThread(ThreadFunction tf)
 {
     this.WorkerSupportsCancellation = true;
     this.DoWork += new System.ComponentModel.DoWorkEventHandler(this.this_DoWork);
     _tf          = tf;
 }
Exemplo n.º 7
0
 public Thread(ThreadFunction del)
 {
     Function        = del;
     ManagedThreadId = ThreadIdIndex++;
 }