Re: Thread question (volatile needed?)
Re: Thread question (volatile needed?)
- Subject: Re: Thread question (volatile needed?)
- From: Jay Vaughan <email@hidden>
- Date: Wed, 11 Jun 2003 17:06:46 +0200
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...
Yeah, okay, ummm ... I know about optimizations, parallelism and
pipelines (we do DSP work here at Access) and such, but this is not
what I meant.
He was asking if his lock might come after the assignment ... what
compiler is going to 'optimize' this into parallel, pipelined
instructions which somehow get optimized out of order and result in
totally re-arranged program flow?
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".
His thread problem, I surmise (correct me if I'm wrong), had more to
do with the fact that he's not properly treating his locks properly
and the critical section he thought is protected is not protected at
all ...
--
;
Jay Vaughan
r&d>>music:technology:synthesizers - www.access-music.de/
_______________________________________________
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.