NSWorkspace race condition
NSWorkspace race condition
- Subject: NSWorkspace race condition
- From: Steve Gehrman <email@hidden>
- Date: Wed, 16 May 2001 18:32:55 -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...
[[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