diff -Naur control-0.0.2a/gateway.c control-0.0.2a-patched/gateway.c
--- control-0.0.2a/gateway.c	2006-02-25 00:29:50.000000000 +0100
+++ control-0.0.2a-patched/gateway.c	2006-03-07 02:21:21.000000000 +0100
@@ -32,6 +32,7 @@
 #endif
   _active	(false),
   _terminating	(false),
+  _doCancel (true),
   _hPipe	(socket),
   _pTelnet	(0),
   _pFormatter   (0)
@@ -69,7 +70,7 @@
 cCtrlGateway::~cCtrlGateway() {
   _terminating = true;
   _active = false;
-  Cancel(200);
+  if (_doCancel) Cancel(200);
   Close();
 }
 
@@ -172,8 +173,10 @@
 
 //  UnprepareSocket();
 
-  if (! _terminating)
+  if (! _terminating) {
+  	_doCancel = false; // dont cancel own thread
     gl_CtrlGatewayCol.Del(this);
+  }
 
   conDSYSLOG("gateway thread ended (pid=%d)", getpid());
 conLOG_GATEW("gateway thread ended (pid=%d)", getpid());
diff -Naur control-0.0.2a/gateway.h control-0.0.2a-patched/gateway.h
--- control-0.0.2a/gateway.h	2004-07-02 21:24:22.000000000 +0200
+++ control-0.0.2a-patched/gateway.h	2006-03-07 02:20:49.000000000 +0100
@@ -43,6 +43,7 @@
 
   volatile bool    _active;
   bool             _terminating;
+  bool             _doCancel;
   int              _hPipe;
   cCtrlStack       _stack;
   cCtrlTelnet*     _pTelnet;
