Terminate loopless thread instantly without Abort or Suspend
问题 I am implementing a protocol library. Here a simplified description. The main thread within the main function will always check, whether some data is available on the the networkstream (within a tcpclient). Let us say response is the received message and thread is a running thread. thread = new Thread(new ThreadStart(function)); thread.IsBackground = true; thread.Start(); while(true){ response = receiveMessage(); if (response != null) { thread.Suspend(); //I am searching for an alternative