示例#1
0
 /// <summary>Create a new timer to signal on interrupt on the caller.</summary>
 /// <remarks>
 /// Create a new timer to signal on interrupt on the caller.
 /// <p>
 /// The timer thread is created in the calling thread's ThreadGroup.
 /// </remarks>
 /// <param name="threadName">name of the timer thread.</param>
 public InterruptTimer(string threadName)
 {
     state      = new InterruptTimer.AlarmState();
     autoKiller = new InterruptTimer.AutoKiller(state);
     thread     = new InterruptTimer.AlarmThread(threadName, state);
     thread.Start();
 }
示例#2
0
 internal AutoKiller(InterruptTimer.AlarmState s)
 {
     // The trick here is, the AlarmThread does not have a reference to the
     // AutoKiller instance, only the InterruptTimer itself does. Thus when
     // the InterruptTimer is GC'd, the AutoKiller is also unreachable and
     // can be GC'd. When it gets finalized, it tells the AlarmThread to
     // terminate, triggering the thread to exit gracefully.
     //
     state = s;
 }
示例#3
0
 internal AutoKiller(InterruptTimer.AlarmState s)
 {
     // The trick here is, the AlarmThread does not have a reference to the
     // AutoKiller instance, only the InterruptTimer itself does. Thus when
     // the InterruptTimer is GC'd, the AutoKiller is also unreachable and
     // can be GC'd. When it gets finalized, it tells the AlarmThread to
     // terminate, triggering the thread to exit gracefully.
     //
     state = s;
 }
示例#4
0
 /// <summary>Create a new timer to signal on interrupt on the caller.</summary>
 /// <remarks>
 /// Create a new timer to signal on interrupt on the caller.
 /// <p/>
 /// The timer thread is created in the calling thread's ThreadGroup.
 /// </remarks>
 /// <param name="threadName">name of the timer thread.</param>
 public InterruptTimer(string threadName)
 {
     state = new InterruptTimer.AlarmState();
     autoKiller = new InterruptTimer.AutoKiller(state);
     thread = new InterruptTimer.AlarmThread(threadName, state);
     thread.Start();
 }
示例#5
0
 internal AlarmThread(string name, InterruptTimer.AlarmState q) : base(q)
 {
     //
     SetName(name);
     SetDaemon(true);
 }