54 static long timeout = 0; 55 56 // tested thread 57 tc02t001Thread thread = null; 58 59 // run debuggee 60 public int runIt(String argv[], PrintStream out) { 61 argHandler = new ArgumentHandler(argv); 62 log = new Log(out, argHandler); 63 timeout = argHandler.getWaitTime() * 60 * 1000; 64 log.display("Timeout = " + timeout + " msc."); 65 66 thread = new tc02t001Thread("Debuggee Thread"); 67 synchronized (thread.M) { 68 thread.start(); 69 thread.startingBarrier.waitFor(); 70 status = checkStatus(status); 71 72 thread.waitingBarrier1.unlock(); 73 try { 74 Thread.sleep(100); 75 thread.M.wait(timeout); 76 } catch (InterruptedException e) { 77 throw new Failure(e); 78 } 79 80 thread.waitingBarrier2.unlock(); 81 try { 82 Thread.sleep(100); 83 thread.M.wait(timeout); 84 } catch (InterruptedException e) { 85 throw new Failure(e); 86 } 87 88 thread.waitingBarrier3.unlock(); 89 try { 90 Thread.sleep(100); 91 thread.M.wait(timeout); 92 } catch (InterruptedException e) { 93 throw new Failure(e); 94 } 95 } 96 97 try { 98 thread.join(timeout); 99 } catch (InterruptedException e) { 100 throw new Failure(e); 101 } 102 103 log.display("Debugee finished"); 104 status = checkStatus(status); 105 106 return status; 107 } 108 } 109 110 /* =================================================================== */ | 54 static long timeout = 0; 55 56 // tested thread 57 tc02t001Thread thread = null; 58 59 // run debuggee 60 public int runIt(String argv[], PrintStream out) { 61 argHandler = new ArgumentHandler(argv); 62 log = new Log(out, argHandler); 63 timeout = argHandler.getWaitTime() * 60 * 1000; 64 log.display("Timeout = " + timeout + " msc."); 65 66 thread = new tc02t001Thread("Debuggee Thread"); 67 synchronized (thread.M) { 68 thread.start(); 69 thread.startingBarrier.waitFor(); 70 status = checkStatus(status); 71 72 thread.waitingBarrier1.unlock(); 73 try { 74 Thread.sleep(1000); 75 thread.M.wait(timeout); 76 } catch (InterruptedException e) { 77 throw new Failure(e); 78 } 79 80 thread.waitingBarrier2.unlock(); 81 try { 82 Thread.sleep(1000); 83 thread.M.wait(timeout); 84 } catch (InterruptedException e) { 85 throw new Failure(e); 86 } 87 88 thread.waitingBarrier3.unlock(); 89 try { 90 Thread.sleep(1000); 91 thread.M.wait(timeout); 92 } catch (InterruptedException e) { 93 throw new Failure(e); 94 } 95 } 96 97 try { 98 thread.join(timeout); 99 } catch (InterruptedException e) { 100 throw new Failure(e); 101 } 102 103 log.display("Debugee finished"); 104 status = checkStatus(status); 105 106 return status; 107 } 108 } 109 110 /* =================================================================== */ |