} // main public void DoWork() { Thread jthread = null; if (_initialized == true) { double result; try { for (int i = 0; i < _numthreads; i++) { _t1[i].Start(); _t2[i].Start(); _t3[i].Start(); } // wait for all the threads to finish... for (int j = 0; j < _numthreads; j++) { _t1[j].Join(); _t2[j].Join(); _t3[j].Join(); } result = (_f.Result() + _g.Result() + _h.Result()); Console.Write("The result is "); Console.WriteLine(result); } catch (Exception e0) { Console.WriteLine("Thread(s) FAILED to Start"); } // start and run a thread that throws an exception if (_exceptionthread) { MyException.MyException jexception; jexception = new MyException.MyException(16); jthread = new Thread(new ThreadStart(jexception.Run)); if (jthread != null) { jthread.Start(); jthread.Join(); } } } else { throw new Exception("Threads FAILED to Initialize"); } } // DoWork
} // main public void DoWork() { Thread jthread = null; if ( _initialized == true ) { double result; try { for ( int i = 0; i < _numthreads; i++ ) { _t1[i].Start(); _t2[i].Start(); _t3[i].Start(); } // wait for all the threads to finish... for ( int j = 0; j < _numthreads; j++ ) { _t1[j].Join(); _t2[j].Join(); _t3[j].Join(); } result = (_f.Result() + _g.Result() + _h.Result()); Console.Write( "The result is " ); Console.WriteLine( result ); } catch( Exception e0 ) { Console.WriteLine( "Thread(s) FAILED to Start" ); } // start and run a thread that throws an exception if ( _exceptionthread ) { MyException.MyException jexception; jexception = new MyException.MyException( 16 ); jthread = new Thread( new ThreadStart( jexception.Run ) ); if ( jthread != null ) { jthread.Start(); jthread.Join(); } } } else throw new Exception( "Threads FAILED to Initialize" ); } // DoWork