Exemplo n.º 1
0
        public delegate void ThreadRoutine(); //declaração do delegate

        //
        // Summary:
        //     Initializes a new instance of the ThreadHandler class.
        //
        // Parameters:
        //   threadfunction:
        //     A ThreadRoutine delegate that represents the methods to be invoked
        //    repeatedly when this thread is running.
        //
        // Exceptions:
        //   T:System.ArgumentNullException:
        //     The start parameter is null.
        public ThreadHandler(ThreadRoutine threadfunction) //recebe o método a ser invocado repetidamente pela thread
        {
            if (threadfunction.Equals(null))
            {
                throw new System.ArgumentNullException("threadfunction", "The threadfunction parameter is null.");
            }
            _routine       = threadfunction; //método especificado
            _onEndFunction = new ThreadRoutine(doNothing);
            thread         = new Thread(DoRoutine);
        }
Exemplo n.º 2
0
 //
 // Summary:
 //     Initializes a new instance of the ThreadHandler class.
 //
 // Parameters:
 //   threadfunction:
 //     A ThreadRoutine delegate that represents the methods to be invoked
 //    repeatedly when this thread is running.
 //
 // Exceptions:
 //   T:System.ArgumentNullException:
 //     The start parameter is null.
 public ThreadHandler(ThreadRoutine threadfunction)
 {
     if (threadfunction.Equals(null))
     {
         throw new System.ArgumentNullException("threadfunction", "The threadfunction parameter is null.");
     }
     _routine       = threadfunction;
     _onEndFunction = new ThreadRoutine(doNothing);
     thread         = new Thread(DoRoutine);
 }
Exemplo n.º 3
0
 public void setOnEndFunction(ThreadRoutine onEndFunction) //setar o método de onEndFunction
 {
     _onEndFunction = onEndFunction;
 }
Exemplo n.º 4
0
 public void setOnEndFunction(ThreadRoutine onEndFunction)
 {
     _onEndFunction = onEndFunction;
 }