/* Stops the event thread. It sets the termination request and then waits for the termination handshake.  */
static void SocketCanStopEventThread(void)
/* Stops the event thread. It sets the termination request and then waits for the termination handshake.  */
static void SocketCanStopEventThread(void)
{
  bool terminatedCpy = false;
  UtilCriticalSectionEnter();
  eventThreadCtrl.terminate = true;
  UtilCriticalSectionExit();
  while (!terminatedCpy)
  {
    UtilCriticalSectionEnter();
    terminatedCpy = eventThreadCtrl.terminated;
    UtilCriticalSectionExit();
    UtilTimeDelayMs(10);
  }
}