| Reference | Downloads | Github

Quit on error when multithreading with ResponseEmulator

Hi all,

I’m trying to do real integration testing of several different experiments, using sample responses and @jeremygray 's ResponseEmulator. This works great when it works, but if I have any errors in the task that would normally cause an error to bubble up and stop execution, the multithreading hangs on responses.

I’m not super-familiar with the way that multithreading is being used here, but I’m presuming there’s some way to tell the response thread to stop and quit if there’s an error in the main thread; maybe by cueing in core.quit() to the fact that there are multiple threads going.

Anyone have experience with this before, or ideas on what I could do? Thanks!

Here’s a guess–easy and quick to try but might not work: In hardware/, in class ResponseEmulator.__init__, just after this line:

threading.Thread.__init__(self, None, 'ResponseEmulator', None)

add this:


That flag lets python shutdown even if this thread is still active. Might work, might not.

That’s great - worked like a charm!

Any reason to not include this line upstream?

I think including in master would be great.

1 Like