[Tutor] Changing instance attributes in different threads

Bernard Lebel 3dbernard at gmail.com
Mon Feb 6 21:41:13 CET 2006


Hello,

I have an instance attribute (a few characters string) that two
separate threads may change, potentially both at the same time.
My program doesn't implement thread safety for this particular task.

So far I have never run into issues with this, but I have been reading
about data corruption when two threads try to write to the same data
at once. I'm just about to deploy my program over 70 computers, so now
I'm having some seconds thoughts of dread.

Should changing instance attributes be done with maximum thread
safety? That is, to use some sort of queue (like the Queue class) so
that all changes to the attribute goes through this queue and can
never happen concurrently?


Thanks in advance
Bernard


More information about the Tutor mailing list