Re: Thread question (volatile needed?)
Re: Thread question (volatile needed?)
- Subject: Re: Thread question (volatile needed?)
- From: Marcel Weiher <email@hidden>
- Date: Wed, 11 Jun 2003 15:21:38 +0200
On Wednesday, June 11, 2003, at 02:57 Uhr, Jay Vaughan wrote:
My question: Can I be sure that the pointer to "object" is surely
read _after_ my [lock lock] statement? Or could it be that some
compilers (or with some compiler options) this reading may be made
before the locking statement?
Any compiler which switches the order of execution of written code
based on a switch is braindead. I certainly hope nothing like this
happens with the GCC under OSX!
Well, then you are not going to like *any* modern optimizing C
compiler...
However, the compiler is not allowed to move code around if the result
is not semantically equivalent, and since the compiler can't know what
it happens in message-sends, such sends tend to be "synchronization
points".
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
f0249ab8b1af193ef5addcf39fdff5ca
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.