• 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: Synchronizing Thread Execution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Synchronizing Thread Execution


  • Subject: Re: Synchronizing Thread Execution
  • From: Antonio Nunes <email@hidden>
  • Date: Tue, 5 Dec 2006 03:15:17 +0000

On 4 Dec 2006, at 18:54, leenoori wrote:

That's what I thought too, but after some experimentation it doesn't seem to work, or I am misunderstanding what it means. Using the above expression it seems the objects are being modified from somewhere else while we are in the critical region. Using @synchronized(self) this doesn't happen. But this last expression still doesn't provide enough protection:

Can't you just stick a file-scoped static variable somewhere and @synchronize on that?


eg.

// single static variable shared by all instances:
static id foo = nil;

@implementation Thing

- (void)method
{
    @synchronized(foo)
    {
        // do something
    }
}

@end

Thanks for the suggestion, but it it didn't work. It gave more problems than using @synchronized(self) in that the results were similar to those using @synchronized(NSStringFromSelector(_cmd)), namely re-entry within the same object.


-António

-----------------------------------------------------------
And could you keep your heart in wonder
at the daily miracles of your life,
your pain would not seem less wondrous
than your joy.

--Kahlil Gibran
-----------------------------------------------------------



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Synchronizing Thread Execution (From: Antonio Nunes <email@hidden>)
 >Re: Synchronizing Thread Execution (From: Chris Suter <email@hidden>)
 >Re: Synchronizing Thread Execution (From: Antonio Nunes <email@hidden>)
 >Re: Synchronizing Thread Execution (From: leenoori <email@hidden>)

  • Prev by Date: Re: Re: Synchronizing Thread Execution
  • Next by Date: Re: Synchronizing Thread Execution
  • Previous by thread: Re: Synchronizing Thread Execution
  • Next by thread: Re: Synchronizing Thread Execution
  • Index(es):
    • Date
    • Thread