none
Why ManualResetEvent is Blocked the UI Thread? RRS feed

  • Question

  • Hi,

        I am creating one thread for do some tasks. Inside that child thread i put WaitOne() call. This is ManualResetEvent API call. I am setting this event inside the parent (UI) thread. But this WaitOne() call is blocking my UI. so it looks like hanging. any help would be appreciated.

    private static ManualResetEvent ChildThreadEvent = new ManualResetEvent(false);
    private Thread thrdEngine = null;
    
    private void btnStart_Click(object sender, EventArgs e)
      {
       
       if (thrdEngine != null)
       {
        ChildThreadEvent.Set();
        thrdEngine.Abort();
       }
    
       thrdEngine = new Thread(new ThreadStart(PerformConfigTest));
       thrdEngine.Start();
    
      }
    
    private void PerformConfigTest()
      {
       //Do some work here
    
    ChildThreadEvent.WaitOne();
       }
    

    Thanks and Regards, vinothkumar.A
    Tuesday, August 23, 2011 1:46 PM