basic python threading question

matt matt at virtualspectator.com
Thu Sep 28 22:19:22 CEST 2000


What is wrong with doing a deep copy?

And I thought atomic object were thread safe by definition, in so far as only
one processing cycle is required to execute it.  If something is not thread
safe then it needs to be atomic such that in the more abstract sense a  call on
it will have to go to completion before anything else gets a chance to use it.

The other thing I am confused about is that I never really thought the object
itself could be thread-safe.  Isn't thread safety only to do with how you
handle the methods that use an object, such that any methods that change an
object, and these should be part of the definition of the object, are the
things that are atomic.

Matt 

On Fri, 29 Sep 2000, Tom wrote:
> I decided to give a thread its own copy of some data.  But I gather that it
> is impossible to create a seperate copy of an atomic object (because the
> implementation is free to make both names bind to the same object).
> 
> This would be a problem for threading, unless all atomic objects are
> thead-safe.  Now, all atomic objects appear to me to be immutable.  Are
> immutable objects inherently thread-safe in Python (even if the ref count
> change)?
> 
> Thanks,
> 
> Tom.
> 
> 
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list