From b2c3083beaa7200968e221a76bd2cfa1a49cfcad Mon Sep 17 00:00:00 2001 From: Bill Gribble Date: Fri, 2 Dec 2016 08:20:34 -0500 Subject: [PATCH] GitHub #281: Don't start threads until ready --- mfp/builtins/sendrcv.py | 11 +++++++++-- mfp/mfp_main.py | 2 ++ mfp/patch.py | 5 ++++- mfpdsp/mfp_rpc.c | 1 - 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/mfp/builtins/sendrcv.py b/mfp/builtins/sendrcv.py index 7874d371..6950bced 100644 --- a/mfp/builtins/sendrcv.py +++ b/mfp/builtins/sendrcv.py @@ -19,9 +19,13 @@ class Send (Processor): bus_type = "bus" - task_nibbler = TaskNibbler() + task_nibbler = None def __init__(self, init_type, init_args, patch, scope, name): + + if not Send.task_nibbler: + Send.task_nibbler = TaskNibbler() + self.dest_name = None self.dest_inlet = 0 self.dest_obj = None @@ -238,9 +242,12 @@ class Recv (Processor): doc_tooltip_inlet = [ "Passthru input" ] doc_tooltip_outlet = [ "Passthru output" ] - task_nibbler = TaskNibbler() + task_nibbler = None def __init__(self, init_type, init_args, patch, scope, name): + if not Recv.task_nibbler: + Recv.task_nibbler = TaskNibbler() + Processor.__init__(self, 2, 1, init_type, init_args, patch, scope, name) initargs, kwargs = self.parse_args(init_args) diff --git a/mfp/mfp_main.py b/mfp/mfp_main.py index d159ef2f..d8d7fb26 100644 --- a/mfp/mfp_main.py +++ b/mfp/mfp_main.py @@ -10,6 +10,8 @@ import string import sys, os import argparse +import threading + from datetime import datetime, timedelta from .evaluator import Evaluator, LazyExpr diff --git a/mfp/patch.py b/mfp/patch.py index 7de9d1e4..cd3315f4 100644 --- a/mfp/patch.py +++ b/mfp/patch.py @@ -23,7 +23,7 @@ class Patch(Processor): display_type = "patch" default_context = None - task_nibbler = TaskNibbler() + task_nibbler = None def __init__(self, init_type, init_args, patch, scope, name, context=None): Processor.__init__(self, 1, 0, init_type, init_args, patch, scope, name) @@ -35,6 +35,9 @@ def __init__(self, init_type, init_args, patch, scope, name, context=None): else: self.context = context + if not Patch.task_nibbler: + Patch.task_nibbler = TaskNibbler() + self.file_origin = None self.objects = {} diff --git a/mfpdsp/mfp_rpc.c b/mfpdsp/mfp_rpc.c index 97df345a..90657dd9 100644 --- a/mfpdsp/mfp_rpc.c +++ b/mfpdsp/mfp_rpc.c @@ -286,7 +286,6 @@ dispatch_methodcall(const char * methodname, JsonObject * params) } } else if (!strcmp(methodname, "exit_request")) { - mfp_log_debug("[RPCHost] Got exit_request\n"); mfp_comm_io_finish(); } else if (!strcmp(methodname, "peer_exit")) {