• 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
Thread safety issue...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Thread safety issue...


  • Subject: Thread safety issue...
  • From: John Draper <email@hidden>
  • Date: Wed, 05 Apr 2006 18:47:04 -0700

So - I have this MTCoreAudio framework - which is probably NOT thread safe, and without it,
I can never hope to deliver my App on time, so how can I make something I know nothing about
thread safe?


I've already read: Introduction to Multithreading Programming Topics
from the docs...


It mentions the use of the "synchronized" directive and some example is shown
below, and I have some questions on this?


Below shows how to use the "synchronized" directive (from the docs)
and I have some questions regarding it.

- (void) myMethod:(id)anObject <--- OK, you got me there, so where would any
self respecting Mac programmer put this?
{
@synchronized(anObject) <--- Would this be perhaps a NSMuteableArray
or another non-thread safe object?
{
// Perform any operations that depend on exclusive access.
[anObject modify];
}


   // The mutex is now released.
}

My questions are: the "anObject" - Is this the NSMuteableArray pointer I want
to keep "thread safe"?


Can ANY object be "anObject" and have it be "protected"?  Could it be my
MTCoreAudio delegate object?

Where is this method normally defined? In my Controller? Or is this called from
within a thread? Obviously, the docs don't tell me this... Argghh - more Guessing
games...


I read and re-read that document, and It's still totally vague and incomplete.
Why don't they use more then a single example.


Can someone please send me any additional examples or code snippits that might
give me some vague clue on how to do this?


John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Thread safety issue...
      • From: Christian Stieber <email@hidden>
  • Prev by Date: Re: Confused about Distributed Objects
  • Next by Date: Re: NSEqualRects returns wrong answer
  • Previous by thread: Re: NSTableView: displaying number of selected rows (error with image)
  • Next by thread: Re: Thread safety issue...
  • Index(es):
    • Date
    • Thread