Thanks Simon

I have updated CORR's katcp wrapper to do this by default now.

Jason

On 05 Aug 2009, at 14:10, Simon Cross wrote:

Hi Jason and Suraj

On Wed, 2009-08-05 at 13:55 +0200, Jason Manley wrote:
Yes, I have had similar experiences. You have to close any open
connections yourself, else the (separate) thread with the open port
stays open, hanging the exit procedure. myroachobject.stop() does
this. Take a look at some of my scripts in the corr package to see an
example.

Perhaps you can daemonise the thread or something to work around this
issue. I haven't explored it too carefully myself. I've cc'd Simon
Cross (original author of python KATCP) for his comment.

As described in [1] you can pass a daemon parameter into the call to a
client's .start() method to change whether the thread will keep the
process alive or not.

Calling client.start(daemon=True) [2] should cause the threads to be
killed when the process dies.

This is not done by default because non-shell users of the library
probably want to arrange to clean up the clients properly before exiting and in that case it makes sense to wait for the thread to finish before
ending the process.

[1] http://packages.python.org/katcp/api.html#katcp.BlockingClient.start
[2] Why daemon=True does this becomes more understandable once you
realise that on some platforms threads outlive the process that created
them.

Hope this helps.

Schiavo
Simon



Reply via email to