I found that my app waits for a long time on the main thread while the stack is as follows:
semaphore_wait_trap ()
_dispatch_semaphore_wait_slow ()
GSSystemManagedStorageCopyAllGenerationsInfos ()
GSLibraryCopyAllGenerationsInfos ()
+[NSFileVersion(NSPrivate) _otherNonpurgeableVersionsOfItemAtURL:temporaryStorageIdentifier:] ()
__35-[NSDocument _doCleanupOldVersions]_block_invoke ()
__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
__CFRunLoopDoBlocks ()
__CFRunLoopRun ()
CFRunLoopRunSpecific ()
RunCurrentEventLoopInMode ()
ReceiveNextEventCommon ()
_BlockUntilNextEventMatchingListInModeWithFilter ()
_DPSNextEvent ()
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
-[NSApplication run] ()
NSApplicationMain ()
Other threads seem to be idle.
Is there anything I can do to avoid this method to wait on the main thread?