newbie question on threads

Alex Martelli aleax at aleax.it
Fri Oct 11 03:17:09 EDT 2002


Gonçalo Rodrigues wrote:

> Hi,
> 
> I just started out studying threads and fleshing out my first
> multithreaded app. But there is still one thing that I'm not completely
> sure: If a thread acesses a shared object via a non-altering state
> method, and without locking, is this safe? Or even in this case we might
> run into problems? Better safe-than-sorry strategy?

Yes, you might run into problems if one thread accesses the
shared object X (without altering) AND at the same time
another thread does alter X.  If *no* thread is altering X at
all, then you're safe.


Alex




More information about the Python-list mailing list