Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ProcessWatchImpl/Muffin/OriginalAlertApiReceiever.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 43 by netseed, Fri Dec 11 17:21:35 2009 UTC revision 44 by netseed, Tue Dec 15 16:20:54 2009 UTC
# Line 24  namespace Toast.NicoNico Line 24  namespace Toast.NicoNico
24                          private static readonly TimeSpan RecoverShortDelay = new TimeSpan(0, 0, 10);                          private static readonly TimeSpan RecoverShortDelay = new TimeSpan(0, 0, 10);
25                          private static readonly int RetryThreshold = 2;                          private static readonly int RetryThreshold = 2;
26    
27                          private AutoResetEvent DelayGate_;                          private AutoResetEvent delayGate;
28                          private int TryCount_;                          private int tryCount;
29    
30                          public DelayController()                          public DelayController()
31                          {                          {
32                                  DelayGate_ = new AutoResetEvent(false);                                  delayGate = new AutoResetEvent(false);
33                                  TryCount_ = 0;                                  tryCount = 0;
34                          }                          }
35    
36                          public void WaitOne()                          public void WaitOne()
37                          {                          {
38                                  lock (DelayGate_)                                  lock (delayGate)
39                                  {                                  {
40                                          if (++TryCount_ > RetryThreshold)                                          if (++tryCount > RetryThreshold)
41                                          {                                          {
42                                                  DelayGate_.WaitOne(RecoverLongDelay);                                                  delayGate.WaitOne(RecoverLongDelay);
43                                          }                                          }
44                                          else                                          else
45                                          {                                          {
46                                                  DelayGate_.WaitOne(RecoverShortDelay);                                                  delayGate.WaitOne(RecoverShortDelay);
47                                          }                                          }
48                                  }                                  }
49                          }                          }
50    
51                          public void ResetCount()                          public void ResetCount()
52                          {                          {
53                                  lock (DelayGate_)                                  lock (delayGate)
54                                  {                                  {
55                                          TryCount_ = 0;                                          tryCount = 0;
56                                  }                                  }
57                          }                          }
58    
59                          public void Dispose()                          public void Dispose()
60                          {                          {
61                                  DelayGate_.Close();                                  delayGate.Close();
62                                  GC.SuppressFinalize(this);                                  GC.SuppressFinalize(this);
63                          }                          }
64                  }                  }
# Line 298  namespace Toast.NicoNico Line 298  namespace Toast.NicoNico
298                                  uint UID = 0;                                  uint UID = 0;
299                                  if (uint.TryParse(Splitter.Replace(Source, "${user}"), out UID))                                  if (uint.TryParse(Splitter.Replace(Source, "${user}"), out UID))
300                                  {                                  {
301                                          if (this.MyId == UID)                                          if (MyId == UID)
302                                          {                                          {
303    
304                                                  //Console.WriteLine(UID);                                                  //Console.WriteLine(UID);
# Line 381  namespace Toast.NicoNico Line 381  namespace Toast.NicoNico
381    
382                          lock (syncRoot)                          lock (syncRoot)
383                          {                          {
384                                  this.status = e.Current;                                  status = e.Current;
385                          }                          }
386                  }                  }
387    

Legend:
Removed from v.43  
changed lines
  Added in v.44

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26