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 14:57:07 +0200
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!
With the purpose of giving you a hint rather than a solution to your
problem, might I suggest that a better question for you to be asking
about your problem is this: "Is my lock really locked?"
If one thread has your lock object locked, and another tries to lock
it and fails, what happens next in your code?
Re-write your accessor methods to use 'trylock' instead, I would suggest ...
--
;
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.