none
ManualResetEvent.Set() blocks current thread RRS feed

  • Question

  • There is a scenario in our customer's computer that ManualRestEvent.Set() blocks current thread. The souce code will stop at ManualRestEvent.Set() function. What could cause this issue?

    Thanks Very much!

    Scott

    Monday, January 14, 2013 2:46 AM

Answers

  • When the one side didn't get the response from the other side, it will wait for 3 minutes. This is the by designed in TCP/IP protocol.

    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    • Marked as answer by ScottQ Wednesday, January 16, 2013 11:49 PM
    Wednesday, January 16, 2013 2:57 AM

All replies

  • http://stackoverflow.com/questions/9638378/what-could-cause-eventwaithandle-set-to-block-the-current-thread

    I have search above website. But I need more detailed information, and then tell the customer what to do or how to modify my source codes.

    Monday, January 14, 2013 2:47 AM
  • Just start the application again.

    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    Monday, January 14, 2013 8:54 AM
  • Today, I still worked on this issue. Maybe, it is .net remoting caused the customer's issue.

    The following code is in .net remoting server (PC1).  The method mClientRemoteBridge.Ready() is in .net remoting 

    client (PC2).

    Case 1, unplug network cable of PC2, the following codes worked fine. In debugview, trace1 and trace4 could be 

    found.  trace 4 is

    A connection attempt failed because the connected party did not properly respond after a period of time, or 

    established connection failed because connected host has failed to respond xxx.xxx.xxx.xxx:xxxx.

    Case 2. power off PC2. Only trace 1 could be found. Maybe, this thread was hang at  mClientRemoteBridge.Ready().

    try
    {
         //write trace 1

         if (this.mClientRemoteBridge.Ready(this.ID) == false) // the method in remote client.
          {
               //write trace 2

                throw new Exception("....");
          }
          this.ManualResetEvent.Set();
          //write trace 3

    }
    catch (System.Exception exp)
    {
         //write trace 4
    }

    My question is why it worked fine to disconnect .net remoting client.

    however, the thread was hang when power off .net remoting client.
    Tuesday, January 15, 2013 8:36 AM
  • When the one side didn't get the response from the other side, it will wait for 3 minutes. This is the by designed in TCP/IP protocol.

    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    • Marked as answer by ScottQ Wednesday, January 16, 2013 11:49 PM
    Wednesday, January 16, 2013 2:57 AM