etwist/server.py
branchstable
changeset 5652 904091dc4c7e
parent 5553 646737f80c88
child 5655 ef903fff826d
child 5660 97343804414b
--- a/etwist/server.py	Tue Jun 01 17:29:49 2010 +0200
+++ b/etwist/server.py	Tue Jun 01 17:44:55 2010 +0200
@@ -25,6 +25,7 @@
 import select
 import errno
 import traceback
+import threading
 from os.path import join
 from time import mktime
 from datetime import date, timedelta
@@ -407,8 +408,11 @@
         os.setuid(uid)
     root_resource.start_service()
     logger.info('instance started on %s', root_resource.base_url)
+    # avoid annoying warnign if not in Main Thread
+    signals = threading.currentThread().getName() == 'MainThread'
     if config['profile']:
         import cProfile
-        cProfile.runctx('reactor.run()', globals(), locals(), config['profile'])
+        cProfile.runctx('reactor.run(installSignalHandlers=%s)' % signals,
+                        globals(), locals(), config['profile'])
     else:
-        reactor.run()
+        reactor.run(installSignalHandlers=signals)