-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Feb 25, 2002 at 12:55:07PM -0800, Andy Ross wrote: > Martin van Beilen wrote: > > Actually it is fairly easy to make the property manager Thread > > Safe<tm>. All regular r/w locking can happen on a per-node basis, and > > can be encapsulated transparently. > Making the property manager threadsafe isn't the issue; sure it can be > done. The problem is that *using* the property manager (or anything) > from multiple threads leaves you open to race conditions that occur > due to unsynchronized changes to the property values. Hmmm.. I think we have different definitions of "threadsafe". > For those with Java experience, consider the Vector class. It's > threadsafe, right? No, it's not. Imagine what happens when one thread is reading it while another thread is writing to it. :-) > Right. Now enumerate over it in one thread while > modifying it in another. Is *that* threadsafe? :) Now what did I just say? Pay attention please. ;-) A solution is to subclass a MutexVector that provides transparent locking on member access. Since there is only one mutex involved, deadlocks cannot occur. It is now Thread Safe<tm> for all r/w operations. Of course, this breaks when deleting the vector. Which is what my earlier post was about. Not that it matters, since we're not doing multithreading on properties in the first place. :-) - -- Regards, "I RADIS, do you?" =Martin= http://www.iradis.org/ PGP: FE87448B DDF8 677C 9244 D119 4FE0 AE3A 37CF 3458 FE87 448B From: Martin van Beilen <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: [Flightgear-devel] New subsystem: FGEnvironment In-Reply-To: <[EMAIL PROTECTED]>; from [EMAIL PROTECTED] on Mon, Feb 25, 2002 at 12:55:07PM -0800 X-S-Issue: [EMAIL PROTECTED] 2002/02/26 00:24:34 0800dc9a27bf18f991a6c1eb2a5bc123 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) iEYEARECAAYFAjx6x7kACgkQN880WP6HRIsKIgCdFja4q0wUowN2D5WS4YaaLTp4 7roAoJeRQTRvEmPu//KaNi+MSR54IGm7 =6/c6 -----END PGP SIGNATURE----- _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel