Re: Re: PubSub and working thread
Nicolas Pinault <[email protected]> Thu, 4 Apr 2019 19:17:21 +0200
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------1328A2619556E0DBD87A15EE Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable Le 04/04/2019 =C3=A0 00:18, Robin Dunn a =C3=A9crit=C2=A0: > On Wednesday, April 3, 2019 at 1:28:01 PM UTC-7, Nicolas Pinault wrote: > > Hi, > > I have an application where I need to communicate between a working > thread and wx frames. > Threads can't directly call UI API so I usually do this with wx > events. > The working thread sends messages to a frames using wx.Event. > It works=C2=A0 but this not as simple as with PubSub. > My concern is about the thread safety of PubSub. Is it safe to > publish > from a working thread and subscribe from wx frames ? > > > PubSub doesn't do anything with, nor is aware of threads. This means=20 > that the subscriber will be called in whatever thread was active when=20 > the message was sent. That's what I thought but I wanted to be sure. > It's not difficult to work around however, as the subscribed function=20 > could simply use wx.CallAfter to schedule a call to some other=20 > function to do the real work. Thanks for the tip :) Nicolas > > -- > Robin > > --=20 > You received this message because you are subscribed to the Google=20 > Groups "wxPython-dev" group. > To unsubscribe from this group and stop receiving emails from it, send=20 > an email to [email protected]=20 > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout. --=20 You received this message because you are subscribed to the Google Groups "= wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected]. For more options, visit https://groups.google.com/d/optout. --------------1328A2619556E0DBD87A15EE Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8= "> </head> <body text=3D"#000000" bgcolor=3D"#FFFFFF"> <div class=3D"moz-cite-prefix">Le 04/04/2019 =C3=A0 00:18, Robin Dunn a =C3=A9crit=C2=A0:<br> </div> <blockquote type=3D"cite" cite=3D"mid:[email protected]"> <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DUTF= -8"> <div dir=3D"ltr">On Wednesday, April 3, 2019 at 1:28:01 PM UTC-7, Nicolas Pinault wrote: <blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hi, <br> <br> I have an application where I need to communicate between a working <br> thread and wx frames. <br> Threads can't directly call UI API so I usually do this with wx events. <br> The working thread sends messages to a frames using wx.Event. <br> It works=C2=A0 but this not as simple as with PubSub. <br> My concern is about the thread safety of PubSub. Is it safe to publish <br> from a working thread and subscribe from wx frames ? <br> </blockquote> <div><br> </div> <div>PubSub doesn't do anything with, nor is aware of threads. This means that the subscriber will be called in whatever thread was active when the message was sent. </div> </div> </blockquote> That's what I thought but I wanted to be sure.<br> <blockquote type=3D"cite" cite=3D"mid:[email protected]"> <div dir=3D"ltr"> <div>It's not difficult to work around however, as the subscribed function could simply use wx.CallAfter to schedule a call to some other function to do the real work.</div> </div> </blockquote> Thanks for the tip :)<br> <br> Nicolas<br> <blockquote type=3D"cite" cite=3D"mid:[email protected]"> <div dir=3D"ltr"> <div><br> </div> <div>--</div> <div>Robin</div> <div><br> </div> </div> -- <br> You received this message because you are subscribed to the Google Groups "wxPython-dev" group.<br> To unsubscribe from this group and stop receiving emails from it, send an email to <a href=3D"mailto:[email protected]" moz-do-not-send=3D"true">[email protected]<= /a>.<br> For more options, visit <a href=3D"https://groups.google.com/d/optout" moz-do-not-send=3D"true= ">https://groups.google.com/d/optout</a>.<br> </blockquote> <br> </body> </html> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;wxPython-dev" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">wxPyth= [email protected]</a>.<br /> For more options, visit <a href=3D"https://groups.google.com/d/optout">http= s://groups.google.com/d/optout</a>.<br /> --------------1328A2619556E0DBD87A15EE--