Menu

ThreadStateException when reinitializing Sock

2010-05-17
2013-04-17
  • ben.biddington

    ben.biddington - 2010-05-17

    Hi,

    I am getting the following error after the following steps:

    1. Initialiize new SockIOPool
    2. Shut it down
    3. Initialize another SockIOPool with the same name

    System.Threading.ThreadStateException : Thread is running or terminated; it cannot restart.

    If I modify the shutdown routine (SockIOPool.cs, line 1086) to null the maintenance thread:

    [MethodImpl(MethodImplOptions.Synchronized)]
            public void Shutdown()
            {
                if(Log.IsDebugEnabled)
                {
                    Log.Debug(GetLocalizedString("start socket pool shutdown"));
                }
                if(_maintenanceThread != null && _maintenanceThread.IsRunning)
                    StopMaintenanceThread();
                _maintenanceThread = null; // This is what I add
               // ...
        }
    

    then the problem goes away.
    What am I doing wrong?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.