• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: @synchronized question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: @synchronized question
      • From: Mel Walker <email@hidden>
References: 
 >@synchronized question (From: Mel Walker <email@hidden>)

  • Prev by Date: Calling an Action from a function
  • Next by Date: Re: [Q] Inheritance, Composition and Abstract super classes
  • Previous by thread: @synchronized question
  • Next by thread: Re: @synchronized question
  • Index(es):
    • Date
    • Thread