CFRunLoop.h/.c
每个线程创建的struct __CFRunLoop
都会存储到下面静态dict里。
static CFMutableDictionaryRef __CFRunLoops = NULL;
_CFRunLoopGet0里首次调用时,触发静态变量__CFRunLoops
的创建。
存储代码:
CFDictionarySetValue(__CFRunLoops, pthreadPointer(t), newLoop);
t为pthread_t
。
CFRuntime.h/.c
保存runtime类信息的全局变量:
CF_PRIVATE CFRuntimeClass * __CFRuntimeClassTable[__CFRuntimeClassTableSize] = {0};
CF_PRIVATE int32_t __CFRuntimeClassTableCount = 0;
CF_PRIVATE uintptr_t __CFRuntimeObjCClassTable[__CFRuntimeClassTableSize] = {0};
在__CFInitialize
里初始化:
static void __CFInitialize(void) __attribute__ ((constructor));
CFSocket.h/.c
// On Mach we use a v0 RunLoopSource to make cli