2 package org.feistymeow.process;
5 // not compilable yet probably,
6 // plus missing the timed features of ethread.
9 import java.io.BufferedOutputStream;
11 import java.io.IOException;
12 import java.io.InputStreamReader;
13 import java.io.Reader;
14 import java.util.regex.Matcher;
15 import java.util.regex.Pattern;
17 import org.apache.commons.logging.Log;
18 import org.apache.commons.logging.LogFactory;
21 * A simple java thread that hearkens back to the HOOPLE C++ ethread in features.
23 * @author Chris Koeritz
25 class ethread implements Runnable
27 //fix below to use better way to get class object.
28 private static Log c_logger = LogFactory.getLog(ethread.class);
30 private volatile Thread c_RealThread = null;
32 // the only variable on which both synchronize is the "thread finished" variable.
38 * Begins execution of the thread.
42 if( null == this.c_RealThread )
44 this.c_RealThread = new Thread(this);
45 this.c_RealThread.start();
50 * Stops execution of the thread, or at least attempts to.
54 Thread goAway = c_RealThread;
56 if (null != goAway) { goAway.interrupt(); }
60 * Returns true if the thread isn't null.
62 public boolean threadRunning()
64 return (null != this.c_RealThread);
69 if (false == threadRunning())
71 return; // stopped before it ever started