[Thread-SIG] Re: [Python-Dev] baby steps for free-threading

Salz, Rich SalzR@CertCo.com
Wed, 19 Apr 2000 12:04:48 -0400


>In my experience, allowing/requiring programmers to specify sharedness is
>a very rich source of hard-to-find bugs.

My experience is the opposite, since most objects aren't shared. :)
You could probably do something like add an "owning thread" to each object
structure, and on refcount throw an exception if not shared and the current
thread isn't the owner. Not sure if space is a concern, but since the object
is either shared or needs its own mutex, you make them a union:
	bool shared;
	union {
		python_thread_id_type id;
		python_mutex_type m;
	};


  (Not saying I have an answer to
the performance hit of locking on incref/decref, just saying that the
development cost of 'shared' is very high.)

Greg


_______________________________________________
Thread-SIG maillist  -  Thread-SIG@python.org
http://www.python.org/mailman/listinfo/thread-sig