[nsthread] Code for Controlling NSThread and NSRunLoop Exit