Re: @synchronized question
Re: @synchronized question
- Subject: Re: @synchronized question
- From: Clark Cox <email@hidden>
- Date: Mon, 24 May 2004 14:11:43 -0400
On May 24, 2004, at 12:15, Mel Walker wrote:
>
>
-(void)doSomething {
>
@synchronized(myTextView) {
...
>
}
>
}
>
>
or should I do something like this:
>
>
-(void)doSomething {
>
@synchronized(self) {
...
>
}
>
}
Which one you use depends on which object you're trying to protect
access to. So, for instance, if you have another method:
-(void)doSomethingElse
{
@synchronized(self)
{
//Something that may have nothing to do with myTextView
}
}
This could be blocked if the (self) version of doSomething is
currently running, but won't be blocked if the (myTextView) version is
running. Either way, you should try to be consistent.
--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.