in reply to How do you share an object(Telnet Session) between threads?

Do you want to share the connection itself, or just have an interface that other threads can use to request that the owner of the connection do things on their behalf (presumably with some queuing to prevent mixing messages and mangling command sequences)

  • Comment on Re: How do you share an object(Telnet Session) between threads?

Replies are listed 'Best First'.
Re^2: How do you share an object(Telnet Session) between threads?
by jmlynesjr (Deacon) on Sep 29, 2015 at 19:03 UTC

    I had wanted to share the connection. In the docs I had seen where a reference could be shared, however, I obviously overlooked the "gottcha" that only references to shared scalers are supported. Then I found the doc on shared_clone that seemed to be able to share objects, but it errors also.

    The connect, disconnect, and scan threads are being triggered by shared flags set from Wx button events. I could collapse these threads into one connection server thread and run code sections based on the existing flags. I had pondered that earlier today, but was hoping to avoid rewrite #3.

    I have a non-threaded version that works except for a sequence of button pushes that gets the state confused because of what seems to be async processing of the Telnet connection error. There is a delay in setting the error flag which the event sub mishandles. Thus this second approach.

    Thanks for your response.

    James

    There's never enough time to do it right, but always enough time to do it over...