I know that modifying UI elements from a thread is bad-mojo, but what
about calling methods attached to a class inheriting from a wx object?
In particular, I have a class that inherits from wx.Frame, to which
I've added a few of my own methods. Is it ok for a thread to call one
of those methods, as long as that method does not affect any of the UI
elements? Or should all interaction between threads and anything
deriving from wx.* happen through events?
Thanks,
Jay P.
Ok, that's what I thought. Along the same lines, does a wx.Timer run
in a separate thread, or is part of the UI thread context? I'm
planning on having a wx.Timer touching parts of the UI, but I can't
tell if behind the scenes it's running in a thread.
Jay P.
···
On Thu, Dec 4, 2008 at 4:03 PM, Cody Precord <codyprecord@gmail.com> wrote:
Yes, As long as your method doesn't try to modify or call on anything
belonging to the underlying control, and that you preserve the safety of
manipulating your own data. Meaning if your methods may be called by
multiple threads wanting to manipulate the same data at the same time you
will run into the same problem as calling the gui from a background thread
unless you employ some precautions in your methods (i.e a mutex). Google
"thread safety" if you need more info.