From: Satoshi Kobayashi <[email protected]>

Eventlet's monkey patch overwrite Python standard threading library by default. 
It affects to Python debugger working. This will be often an issue for the user 
of Python debugger. Therefore, it's necessary to add the option which doesn't 
overwrite Python standard threading library.

Signed-off-by: Satoshi Kobayashi <[email protected]>
---
 ryu/cmd/manager.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py
index cdcc7ae..7152daf 100755
--- a/ryu/cmd/manager.py
+++ b/ryu/cmd/manager.py
@@ -17,7 +17,7 @@
 # limitations under the License.
 
 from ryu.lib import hub
-hub.patch()
+hub.patch(thread=False)
 
 # TODO:
 #   Right now, we have our own patched copy of ovs python bindings
@@ -50,6 +50,9 @@ CONF.register_cli_opts([
     cfg.MultiStrOpt('app', positional=True, default=[],
                     help='application module name to run'),
     cfg.StrOpt('pid-file', default=None, help='pid file name'),
+    cfg.BoolOpt('enable-debugger', default=False,
+                help='don\'t overwrite Python standard threading library'
+                '(use only for debugging)'),
 ])
 
 
@@ -64,6 +67,13 @@ def main(args=None, prog=None):
 
     log.init_log()
 
+    if CONF.enable_debugger:
+        LOG = logging.getLogger('ryu.cmd.manager')
+        msg = 'debugging is available (--enable-debugger option is turned on)'
+        LOG.info(msg)
+    else:
+        hub.patch(thread=True)
+
     if CONF.pid_file:
         import os
         with open(CONF.pid_file, 'w') as pid_file:
-- 
1.9.3 (Apple Git-50)


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to