¡@

Home 

2014/10/15 ¤U¤È 10:05:49

iphone Programming Glossary: currentthread

when is it safe to release an NSThread?

http://stackoverflow.com/questions/1151637/when-is-it-safe-to-release-an-nsthread

NSAutoreleasePool alloc init processCondition lock outer loop this loop runs until my application exits while NSThread currentThread isCancelled NSAutoreleasePool middlePool NSAutoreleasePool alloc if processGo inner loop this loop runs typically for.. NSAutoreleasePool alloc if processGo inner loop this loop runs typically for a few seconds while processGo NSThread currentThread isCancelled NSAutoreleasePool innerPool NSAutoreleasePool alloc init within inner loop this takes a fraction of a second..

Getting thread id of current method call

http://stackoverflow.com/questions/1616572/getting-thread-id-of-current-method-call

Generic approach to NSManagedObjectContext in multi-threaded application

http://stackoverflow.com/questions/3474960/generic-approach-to-nsmanagedobjectcontext-in-multi-threaded-application

sharedApplication delegate NSManagedObjectContext moc delegate.managedObjectContext NSThread thread NSThread currentThread if thread isMainThread return moc a key to cache the context for the given thread NSString threadKey NSString stringWithFormat.. void commit get the moc for this thread NSManagedObjectContext moc self managedObjectContext NSThread thread NSThread currentThread if thread isMainThread NO only observe notifications other than the main thread NSNotificationCenter defaultCenter addObserver.. MyAppDelegate UIApplication sharedApplication delegate NSString threadKey NSString stringWithFormat @ p NSThread currentThread NSMutableDictionary managedObjectContexts delegate.managedObjectContexts managedObjectContexts removeObjectForKey threadKey..