Skip to content

Commit

Permalink
GitHub #281: Don't start threads until ready
Browse files Browse the repository at this point in the history
  • Loading branch information
bgribble committed Dec 2, 2016
1 parent 31ac0c2 commit b2c3083
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions mfp/builtins/sendrcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions mfp/mfp_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import string
import sys, os
import argparse
import threading

from datetime import datetime, timedelta

from .evaluator import Evaluator, LazyExpr
Expand Down
5 changes: 4 additions & 1 deletion mfp/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = {}
Expand Down
1 change: 0 additions & 1 deletion mfpdsp/mfp_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down

0 comments on commit b2c3083

Please sign in to comment.