001 package edu.rice.cs.cunit.record.syncPoints.thread;
002
003 import edu.rice.cs.cunit.record.graph.ThreadInfo;
004 import edu.rice.cs.cunit.record.syncPoints.ISyncPointVisitor;
005 import edu.rice.cs.cunit.instrumentors.DoNotInstrument;
006
007 /**
008 * Synchronization point corresponding to a Thread.join call.
009 *
010 * @author Mathias Ricken
011 */
012 @DoNotInstrument
013 public class ThreadEnterJoinSyncPoint extends AThreadSyncPoint {
014 /**
015 * Timeout duration.
016 */
017 private long _timeOut;
018
019 /**
020 * Constructor for this synchronization point.
021 * @param thread thread whose join method was called.
022 * @param timeOut timeout duration
023 */
024 public ThreadEnterJoinSyncPoint(Thread thread, long timeOut) {
025 super(thread);
026 _timeOut = timeOut;
027 }
028
029 /**
030 * Class for translated versions on the monitor side.
031 */
032 public static class Translated extends AThreadSyncPoint.Translated {
033 /**
034 * Timeout duration.
035 */
036 private long _timeOut;
037
038 /**
039 * Constructor for translated version on the monitor side.
040 * @param threadInfo info about the thread
041 * @param timeOut timeout duration
042 */
043 public Translated(ThreadInfo threadInfo, long timeOut) {
044 super(threadInfo);
045 _timeOut = timeOut;
046 }
047
048 /**
049 * Executes a visitor.
050 *
051 * @param visitor visitor to execute
052 * @param param visitor-specific parameter
053 *
054 * @return visitor-specific return value
055 */
056 public <R,P> R execute(ISyncPointVisitor<R, P> visitor, P param) {
057 return visitor.threadJoinCase(this, param);
058 }
059
060 /**
061 * Returns a string representation of the object.
062 * @return a string representation of the object.
063 */
064 public String toString() {
065 return super.toString()+" timeOut="+_timeOut;
066 }
067 }
068 }