Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSWorkspace race condition



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...

[[NSWorkspace sharedWorkspace] isFilePackageAtPath:filePath];

This causes the program to hang in semaphore_wait_trap and I get the spinning rainbow cursor.

Are there restrictions on what you can and can't call when you get notifications?

Heres the Frame info from the debugger if that helps

0 semaphore_wait_trap
1 semaphore_wait
2 pthread_mutex_lock
3 TSLockMutex
4 AcquireVolumeListLock
5 MountVolume
6 FindOrMountVolumeByExactMountPointName
7 ResolveSyntheticAliasFile
8 ... 13
14 [NSWorkspace isFilePackageAtPath]

steve




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.