• 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: NSWorkspace race condition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWorkspace race condition


  • Subject: Re: NSWorkspace race condition
  • From: Deirdre Saoirse Moen <email@hidden>
  • Date: Wed, 16 May 2001 23:36:39 -0700

I have stumbled upon a race condition that causes my app to hang. Is there something I'm doing wrong, or is this a bug in Cocoa?

It's very simple to reproduce: My app is set to be notified when a disk mounts with "NSWorkspaceDidMountNotification", When I insert a CDROM or Zip disk, the notification happens, and I call code to update my internal representation of all mounted volumes. This code eventually calls...

From what you've described it's not a race condition, which is when the result is not deterministic but depends upon which thread wins the race. You're describing something that always has the same result.

Sounds more like you're creating a deadlock.

Rather than try and update the representation there, flag that it needs to be updated and do the update later.

This might not be as simple for you, but it does eliminate the problem and is the general solution for a deadlock.

--
_Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net
Macintosh Developer (seeking work): Will work for Cocoa
"I love deadlines. I like the whooshing sound they make as they fly by."
- Douglas Adams


References: 
 >NSWorkspace race condition (From: Steve Gehrman <email@hidden>)

  • Prev by Date: Async File Copying?
  • Next by Date: Re: Async File Copying?
  • Previous by thread: NSWorkspace race condition
  • Next by thread: Re: Programatically making a particular text field active?
  • Index(es):
    • Date
    • Thread