Directly calling threaded class instance methods and attributes
lights at cix.co.uk
Fri Oct 29 13:43:57 CEST 2004
"Diez B. Roggisch" <deetsNOSPAM at web.de> wrote in message news:<clqlr6$g32$02$1 at news.t-online.com>...
> > My question is simply, can anyone see any issues with calling methods
> > and/or attributes of a threaded class instance like this? It looks ok
> > to me but, as the docs never seem to mention using threads like this,
> > I'm wondering if I've missed something important.
> So your code is perfectly legal, and as long as you are aware that having
> more complex operations on objects undergoing can be interrupted at any
> time, maybe leaving data inconsistent _from and applications POV_ - then
> you'll need explicid sync'ing, by locks, queues or whatever...
Thanks for your reply. Basically, then, it seems that there aren't
any special considerations required for directly calling threaded
class instance methods / attributes. I'll still need to take care
of ensuring that the application's data structures are kept
internally consistent (which is fair enough - I was expecting to
have to do that anyway) but it looks like I'm not going to cause
any unusual issues.
If so, that's great - it'll help tidy things up quite nicely in
areas where I've got way too many queues to easily keep track of.
Thanks for your help Diez, and thanks also to everyone else who's
commented. It's always an education!
More information about the Python-list