| @@ -14,7 +14,7 namespace Implab.Diagnostics.Interactive | |||
|  | 14 | 14 | TraceForm m_form; | 
|  | 15 | 15 | |
|  | 16 | 16 | SynchronizationContext m_syncGuiThread; | 
|  | 17 | readonly Promise | |
|  | 17 | readonly Promise m_guiStarted = new Promise(); | |
|  | 18 | 18 | |
|  | 19 | 19 | readonly IPromise m_guiFinished; | 
|  | 20 | 20 | // readonly IPromise m_workerFinished = new Promise<object>(); | 
| @@ -30,8 +30,8 namespace Implab.Diagnostics.Interactive | |||
|  | 30 | 30 | readonly ManualResetEvent m_pauseEvent = new ManualResetEvent(true); | 
|  | 31 | 31 | |
|  | 32 | 32 | public InteractiveListener(bool global) : base(global) { | 
|  | 33 | m_guiFinished = AsyncPool. | |
|  | 34 | /*m_workerFinished = */AsyncPool. | |
|  | 33 | m_guiFinished = AsyncPool.RunThread(GuiThread); | |
|  | 34 | /*m_workerFinished = */AsyncPool.RunThread(QueueThread); | |
|  | 35 | 35 | |
|  | 36 | 36 | m_guiStarted.Join(); | 
|  | 37 | 37 | } | 
| @@ -39,12 +39,14 namespace Implab { | |||
|  | 39 | 39 | } | 
|  | 40 | 40 | } | 
|  | 41 | 41 | |
|  | 42 | protected | |
|  | 42 | protected bool BeginSetResult() { | |
|  | 43 | 43 | if (!BeginTransit()) { | 
|  | 44 | 44 | WaitTransition(); | 
|  | 45 | 45 | if (m_state != CANCELLED_STATE) | 
|  | 46 | 46 | throw new InvalidOperationException("The promise is already resolved"); | 
|  | 47 | return false; | |
|  | 47 | 48 | } | 
|  | 49 | return true; | |
|  | 48 | 50 | } | 
|  | 49 | 51 | |
|  | 50 | 52 | protected void EndSetResult() { | 
| @@ -187,6 +187,8 namespace Implab.Parallels { | |||
|  | 187 | 187 | public void EnqueueRange(T[] data, int offset, int length) { | 
|  | 188 | 188 | if (data == null) | 
|  | 189 | 189 | throw new ArgumentNullException("data"); | 
|  | 190 | if (length == 0) | |
|  | 191 | return; | |
|  | 190 | 192 | if (offset < 0) | 
|  | 191 | 193 | throw new ArgumentOutOfRangeException("offset"); | 
|  | 192 | 194 | if (length < 1 || offset + length > data.Length) | 
| @@ -17,6 +17,7 namespace Implab.Parallels { | |||
|  | 17 | 17 | return false; | 
|  | 18 | 18 | m_exclusive = true; | 
|  | 19 | 19 | m_locks = 1; | 
|  | 20 | return true; | |
|  | 20 | 21 | } | 
|  | 21 | 22 | } | 
|  | 22 | 23 | |
| @@ -31,7 +32,7 namespace Implab.Parallels { | |||
|  | 31 | 32 | return true; | 
|  | 32 | 33 | } | 
|  | 33 | 34 | |
|  | 34 | if (m_lock == 0) { | |
|  | 35 | if (m_locks == 0) { | |
|  | 35 | 36 | m_exclusive = false; | 
|  | 36 | 37 | m_locks = 1; | 
|  | 37 | 38 | return true; | 
| @@ -302,10 +302,11 namespace Implab { | |||
|  | 302 | 302 | T m_result; | 
|  | 303 | 303 | |
|  | 304 | 304 | public virtual void Resolve(T value) { | 
|  | 305 | BeginSetResult() | |
|  | 305 | if (BeginSetResult()) { | |
|  | 306 | 306 | m_result = value; | 
|  | 307 | 307 | EndSetResult(); | 
|  | 308 | 308 | } | 
|  | 309 | } | |
|  | 309 | 310 | |
|  | 310 | 311 | public void Reject(Exception error) { | 
|  | 311 | 312 | SetError(error); | 
        
        General Comments 0
    
    
  
  
                      You need to be logged in to leave comments.
                      Login now
                    
                