• 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: Locking/synchronization conundrum
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Locking/synchronization conundrum


  • Subject: Re: Locking/synchronization conundrum
  • From: Derrick Bass <email@hidden>
  • Date: Fri, 17 Mar 2006 11:30:02 -0600

On Mar 17, 2006, at 10:35 AM, Matt Gough wrote:
The problem with this though is that it prevents multiple threads calling fruitForKey: even if no-one is trying to call setFruit:forKey. I only need to prevent more than one thread at a time accessing the dictionary if one (or more) of them is trying to modify it using setFruit:forKey:.

Is there a general solution to this problem?

This is a classic synchronization problem called the "readers- writers" problem. It should be covered in any good operating systems book (I'm a Tannenbaum fan, myself). If I recall, the usual solution involves semaphores, which can be easily emulated on Cocoa using NSConditionLock.

In a Google search, it can be hard to wade through all the research papers to find the well-accepted solutions. I found one useful looking link in a quick Google: <http://greenteapress.com/semaphores/>.

Derrick

_______________________________________________
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


References: 
 >Locking/synchronization conundrum (From: Matt Gough <email@hidden>)

  • Prev by Date: Being a Service provider for Mail.app
  • Next by Date: Re: NSTextView question
  • Previous by thread: Locking/synchronization conundrum
  • Next by thread: Being a Service provider for Mail.app
  • Index(es):
    • Date
    • Thread