CFWindowsMessageQueueRef CFWindowsMessageQueueCreate(CFAllocatorRef allocator, DWORD mask) { CFWindowsMessageQueueRef memory; UInt32 size = sizeof(struct __CFWindowsMessageQueue) - sizeof(CFRuntimeBase); memory = (CFWindowsMessageQueueRef)_CFRuntimeCreateInstance(allocator, __kCFWindowsMessageQueueTypeID, size, NULL); if (NULL == memory) { return NULL; } __CFWindowsMessageQueueSetValid(memory); CF_SPINLOCK_INIT_FOR_STRUCTS(memory->_lock); memory->_mask = mask; memory->_source = NULL; memory->_runLoops = CFArrayCreateMutable(allocator, 0, NULL); return memory; }
CFWindowsMessageQueueRef CFWindowsMessageQueueCreate(CFAllocatorRef allocator, DWORD mask) { CFWindowsMessageQueueRef memory; UInt32 size; size = sizeof(struct __CFWindowsMessageQueue); allocator = (NULL == allocator) ? CFRetain(__CFGetDefaultAllocator()) : CFRetain(allocator); memory = CFAllocatorAllocate(allocator, size, 0); if (NULL == memory) { CFRelease(allocator); return NULL; } __CFGenericInitBase(memory, NULL, __kCFWindowsMessageQueueTypeID); memory->_allocator = allocator; __CFWindowsMessageQueueSetValid(memory); memory->_lock = 0; memory->_mask = mask; memory->_source = NULL; memory->_runLoops = CFArrayCreateMutable(allocator, 0, NULL); return memory; }