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); }
// // 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); }