etwist/server.py
branchstable
changeset 5660 97343804414b
parent 5659 755f56f01c9d
parent 5652 904091dc4c7e
child 5679 0f2ded880d01
child 5759 5db529e0a3ee
--- a/etwist/server.py	Thu Jun 03 15:10:48 2010 +0000
+++ b/etwist/server.py	Thu Jun 03 15:13:41 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)