您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CFRunLoopRunInMode函数代码示例

51自学网 2021-06-01 19:59:06
  C++
这篇教程C++ CFRunLoopRunInMode函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CFRunLoopRunInMode函数的典型用法代码示例。如果您正苦于以下问题:C++ CFRunLoopRunInMode函数的具体用法?C++ CFRunLoopRunInMode怎么用?C++ CFRunLoopRunInMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CFRunLoopRunInMode函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TeensyControls_find_new_usb_devices

void TeensyControls_find_new_usb_devices(void){	while (1) {		int r = CFRunLoopRunInMode(dev_run_mode, 0, true);		if (r != kCFRunLoopRunHandledSource) break;	}}
开发者ID:orthopteroid,项目名称:X-Plane_Plugin,代码行数:7,


示例2: main

intmain(int argc, char **argv){    kern_return_t	kr;    mach_port_t		service_port = MACH_PORT_NULL;    openlog("eapolcfg_auth", LOG_CONS | LOG_PID, LOG_DAEMON);    if (geteuid() != 0) {	syslog(LOG_ERR, "not running as root - exiting");	exit(EX_CONFIG);    }    kr = bootstrap_check_in(bootstrap_port, EAPOLCFG_AUTH_SERVER,			    &service_port);    if (kr != BOOTSTRAP_SUCCESS) {	syslog(LOG_ERR, "bootstrap_check_in() failed: %s",	       bootstrap_strerror(kr));	exit(EX_UNAVAILABLE);    }    start_service(service_port);    while (1) {	SInt32	rlStatus;	rlStatus = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 15.0, TRUE);	if (rlStatus == kCFRunLoopRunTimedOut) {	    if (S_handled_request == FALSE) {		/* we didn't handle a request in the last time interval */		break;	    }	    S_handled_request = FALSE;	}    }    exit(EX_OK);    return (0);}
开发者ID:carriercomm,项目名称:osx-2,代码行数:34,


示例3: iokit_unmount

static int iokit_unmount (MMCDEV *mmc) {    if (0 == mmc->is_mounted) {        return 0; /* nothing to do */    }    BD_DEBUG(DBG_MMC, "Unmounting disk/n");    mmc->session = DASessionCreate (kCFAllocatorDefault);    if (NULL == mmc->session) {        BD_DEBUG(DBG_MMC, "Could not create a disc arbitration session/n");        return -1;    }    mmc->disk = DADiskCreateFromBSDName (kCFAllocatorDefault, mmc->session, mmc->bsd_name);    if (NULL == mmc->disk) {        BD_DEBUG(DBG_MMC, "Could not create a disc arbitration disc for the device/n");        CFRelease (mmc->session);        mmc->session = NULL;        return -1;    }    DAApprovalSessionScheduleWithRunLoop (mmc->session, CFRunLoopGetCurrent (),                                          kCFRunLoopDefaultMode);    DADiskUnmount (mmc->disk, kDADiskUnmountOptionForce, iokit_unmount_complete, mmc);    CFRunLoopRunInMode (kCFRunLoopDefaultMode, 10, true);    return mmc->is_mounted ? -1 : 0;}
开发者ID:ffmpeg-build-win,项目名称:libaacs,代码行数:30,


示例4: IOHIDManagerCreate

void CInputProviderMacOsHid::InputDeviceListenerThread(){	m_hidManager = IOHIDManagerCreate(kCFAllocatorDefault, 0);	{		CFDictionaryRef matchingDict[3];		matchingDict[0] = CreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick);		matchingDict[1] = CreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad);		matchingDict[2] = CreateDeviceMatchingDictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController);		CFArrayRef array = CFArrayCreate(kCFAllocatorDefault, (const void**)matchingDict, 3, &kCFTypeArrayCallBacks);		CFRelease(matchingDict[0]);		CFRelease(matchingDict[1]);		CFRelease(matchingDict[2]);		IOHIDManagerSetDeviceMatchingMultiple(m_hidManager, array);	}	IOHIDManagerRegisterDeviceMatchingCallback(m_hidManager, OnDeviceMatchedStub, this);	IOHIDManagerOpen(m_hidManager, kIOHIDOptionsTypeNone);	IOHIDManagerScheduleWithRunLoop(m_hidManager, CFRunLoopGetCurrent(), CFSTR("CustomLoop"));	while(CFRunLoopRunInMode(CFSTR("CustomLoop"), 1, true) != kCFRunLoopRunStopped && m_running)	{	}	IOHIDManagerClose(m_hidManager, 0);}
开发者ID:jpd002,项目名称:Play-,代码行数:26,


示例5: LOGGER_WARNING

bool HTTPInputSource::Open(CFErrorRef *error){	if(IsOpen()) {		LOGGER_WARNING("org.sbooth.AudioEngine.InputSource.HTTP", "Open() called on an InputSource that is already open");		return true;	}	// Set up the HTTP request	mRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault, CFSTR("GET"), mURL, kCFHTTPVersion1_1);	if(NULL == mRequest) {		if(error)			*error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, ENOMEM, NULL);		return false;	}	CFHTTPMessageSetHeaderFieldValue(mRequest, CFSTR("User-Agent"), CFSTR("SFBAudioEngine"));	// Seek support	if(0 < mDesiredOffset) {		CFStringRef byteRange = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("bytes=%ld-"), mDesiredOffset);		CFHTTPMessageSetHeaderFieldValue(mRequest, CFSTR("Range"), byteRange);		CFRelease(byteRange), byteRange = NULL;	}	mReadStream = CFReadStreamCreateForStreamedHTTPRequest(kCFAllocatorDefault, mRequest, NULL);	if(NULL == mReadStream) {		CFRelease(mRequest), mRequest = NULL;		if(error)			*error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, ENOMEM, NULL);		return false;	}	// Start the HTTP connection	CFStreamClientContext myContext = { 0, this, NULL, NULL, NULL };	CFOptionFlags clientFlags = kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered;    if(!CFReadStreamSetClient(mReadStream, clientFlags, myCFReadStreamClientCallBack, &myContext)) {		CFRelease(mRequest), mRequest = NULL;		CFRelease(mReadStream), mReadStream = NULL;		if(error)			*error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, ENOMEM, NULL);		return false;	}	CFReadStreamScheduleWithRunLoop(mReadStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);	if(!CFReadStreamOpen(mReadStream)) {		CFRelease(mRequest), mRequest = NULL;		CFRelease(mReadStream), mReadStream = NULL;		if(error)			*error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, ENOMEM, NULL);		return false;	}	while(NULL == mResponseHeaders)		CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);	mIsOpen = true;	return true;}
开发者ID:hjzc,项目名称:SFBAudioEngine,代码行数:60,


示例6: while

void CL_SoundOutput_MacOSX::wait(){    while (fragments_available == 0)    {        CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, true);    }}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:7,


示例7: DASessionCreate

/** * Use the DiskArbitration Daemon to inform us of media changes */void MonitorThreadDarwin::run(void){    CFDictionaryRef match     = kDADiskDescriptionMatchVolumeMountable;    DASessionRef    daSession = DASessionCreate(kCFAllocatorDefault);    IOMasterPort(MACH_PORT_NULL, &sMasterPort);    DARegisterDiskAppearedCallback(daSession, match,                                   diskAppearedCallback, this);    DARegisterDiskDisappearedCallback(daSession, match,                                      diskDisappearedCallback, this);    DARegisterDiskDescriptionChangedCallback(daSession, match,                                             kDADiskDescriptionWatchVolumeName,                                             diskChangedCallback, this);    DASessionScheduleWithRunLoop(daSession,                                 CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);    // Nice and simple, as long as our monitor is valid and active,     // loop and let daSession check the devices.    while (m_Monitor && m_Monitor->IsActive())            {        // Run the run loop for interval (milliseconds) - this will        // handle any disk arbitration appeared/dissappeared events        CFRunLoopRunInMode(kCFRunLoopDefaultMode,                           (float) m_Interval / 1000.0f, false );    }    DAUnregisterCallback(daSession, (void(*))diskChangedCallback,     this);    DAUnregisterCallback(daSession, (void(*))diskDisappearedCallback, this);    DAUnregisterCallback(daSession, (void(*))diskAppearedCallback,    this);    CFRelease(daSession);}
开发者ID:royboy626,项目名称:mythtv,代码行数:37,


示例8: atoi

    void TCPStream_CFNetwork::open()    {        if (!serviceName.empty() && serviceName.find_first_not_of("0123456789") == String::npos) {            remoteHostName = domainName;            remotePortNumber = atoi(serviceName.c_str());            if (connect()) {                handleOpenedEvent();            }            handleOpeningFailedEvent();        }        DNS::SRVRecordResolver resolver(serviceName, "tcp", domainName);        resolver.start();        while (!resolver.isDone()) {            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false);        }        //The SRV lookup has completed. Get the results and try to connect        auto results = DNS::SRVRecordResolver::prioritizeResults(resolver.getResults());        for (auto result : results) {            remoteHostName = result.target;            remotePortNumber = result.port;            if (connect()) {                return handleOpenedEvent();            }        }        return handleOpeningFailedEvent();    }
开发者ID:DampKeg,项目名称:DampKeg,代码行数:31,


示例9: ConfigHIDManager

static SDL_boolConfigHIDManager(CFArrayRef matchingArray){    CFRunLoopRef runloop = CFRunLoopGetCurrent();    /* Run in a custom RunLoop mode just while initializing,       so we can detect sticks without messing with everything else. */    CFStringRef tempRunLoopMode = CFSTR("SDLJoystickInit");    if (IOHIDManagerOpen(hidman, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {        return SDL_FALSE;    }    IOHIDManagerRegisterDeviceMatchingCallback(hidman, JoystickDeviceWasAddedCallback, NULL);    IOHIDManagerScheduleWithRunLoop(hidman, runloop, tempRunLoopMode);    IOHIDManagerSetDeviceMatchingMultiple(hidman, matchingArray);    while (CFRunLoopRunInMode(tempRunLoopMode,0,TRUE)==kCFRunLoopRunHandledSource) {        /* no-op. Callback fires once per existing device. */    }    /* Put this in the normal RunLoop mode now, for future hotplug events. */    IOHIDManagerUnscheduleFromRunLoop(hidman, runloop, tempRunLoopMode);    IOHIDManagerScheduleWithRunLoop(hidman, runloop, kCFRunLoopDefaultMode);    return SDL_TRUE;  /* good to go. */}
开发者ID:Helios-vmg,项目名称:CopperRat,代码行数:27,


示例10: pollCfLoop

 void pollCfLoop() {   // this should dispatch ready events and exit   CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);   scheduleCfLoop(); }
开发者ID:AaronTien,项目名称:ndn-cxx,代码行数:7,


示例11: printf

// Async processing thread for keyboard events:static void *KbQueueWorkerThreadMain(void *inarg) {    int deviceIndex = (int) inarg;    int rc;    // Switch ourselves (NULL) to RT scheduling: We promise to use / require at most (0+1) == 1 msec every    // 10 msecs and allow for wakeup delay/jitter of up to 2 msecs -- perfectly reasonable, given that we    // only do minimal << 1 msec processing, only at the timescale of human reaction times, and driven by    // input devices with at least 4+/-4 msecs jitter at 8 msec USB polling frequency.    if ((rc = PsychSetThreadPriority(NULL, 2, 0)) > 0) {        printf("PsychHID: KbQueueCreate: Failed to switch to realtime priority [%s]./n", strerror(rc));    }    // Keep a global reference to the runloop, as we need it in KbQueueRelease to get this thread to exit:    psychHIDKbQueueCFRunLoopRef[deviceIndex] = (CFRunLoopRef) CFRunLoopGetCurrent();    CFRetain(psychHIDKbQueueCFRunLoopRef[deviceIndex]);    // Add HID queue to current runloop:    IOHIDQueueScheduleWithRunLoop(queue[deviceIndex], psychHIDKbQueueCFRunLoopRef[deviceIndex], kCFRunLoopDefaultMode);    // Start the run loop, code execution will block here until run loop is stopped again by PsychHIDKbQueueRelease    // Meanwhile, the run loop of this thread will be responsible for executing code below in PsychHIDKbQueueCalbackFunction    while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, false) == kCFRunLoopRunTimedOut) {};    // Remove HID queue from current runloop:    IOHIDQueueUnscheduleFromRunLoop(queue[deviceIndex], psychHIDKbQueueCFRunLoopRef[deviceIndex], kCFRunLoopDefaultMode);    // Done. Die peacefully:    return(NULL);}
开发者ID:Orca25,项目名称:Psychtoolbox-3,代码行数:30,


示例12: while

Burger::RunQueue::eReturnCode BURGER_API Burger::Mouse::Poll(void *pData){	while (CFRunLoopRunInMode(g_BurgerMouse,0,TRUE)==kCFRunLoopRunHandledSource) {	}#if 0	Word i;	Mouse *pMouse = static_cast<Mouse *>(pData);	DeviceStruct *pRat = pMouse->m_Mice;	for (i = 0; i < pMouse->m_uMiceCount; i++) {		if (pRat->m_bUnplugged) {			IOHIDDeviceRef pDevice = pRat->m_pDevice;			if (pDevice) {				if (IOHIDDeviceOpen(pDevice,kIOHIDOptionsTypeNone) == kIOReturnSuccess) {					pRat->m_bUnplugged = FALSE;	// Connected!					IOHIDDeviceRegisterRemovalCallback(pDevice,DisconnectionCallback,pMouse);					IOHIDDeviceRegisterInputValueCallback(pDevice,InputCallback,pMouse);					CFRunLoopRef pRunLoop = CFRunLoopGetCurrent();					IOHIDDeviceScheduleWithRunLoop(pDevice,pRunLoop,g_BurgerMouse);				}			}		}		++pRat;	}#endif	return RunQueue::OKAY;}
开发者ID:Olde-Skuul,项目名称:burgerlib,代码行数:26,


示例13: caml_release_runtime_system

CFRunLoopRunResult osx_cf_run_loop_run_in_mode(CFStringRef mode, CFTimeInterval seconds, Boolean returnAfterSourceHandled) {  CFRunLoopRunResult r;  caml_release_runtime_system();  r = CFRunLoopRunInMode(mode, seconds, returnAfterSourceHandled);  caml_acquire_runtime_system();  return r;}
开发者ID:yallop,项目名称:ocaml-osx-cf,代码行数:8,


示例14: while

void HIDJoystickManager::update(){    SInt32 status = kCFRunLoopRunHandledSource;        while (status == kCFRunLoopRunHandledSource) {        status = CFRunLoopRunInMode(RunLoopMode, 0, true);    }}
开发者ID:AdamFlores,项目名称:SFML,代码行数:8,


示例15: FetchIPAddress

static void FetchIPAddress(){	if(publicIPState == IPStateFetching)		return;	publicIPState = IPStateFetching;	const UInt8 bodyBytes[] = {0};	CFDataRef body = CFDataCreate(kCFAllocatorDefault, bodyBytes, 0);	CFURLRef url = CFURLCreateWithString(kCFAllocatorDefault, CFSTR("http://icanhazip.com"), NULL);	CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, CFSTR("GET"), url, kCFHTTPVersion1_1);	CFHTTPMessageSetBody(request, body);#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wdeprecated-declarations"	// Apple suggests the NSURLSession API instead of CFReadStreamCreateForHTTPRequest,	// But obviously that doesn't really work here	CFReadStreamRef stream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request);#pragma clang diagnostic pop	CFRelease(body);	CFRelease(url);	CFRelease(request);	CFMutableDataRef responseData = CFDataCreateMutable(kCFAllocatorDefault, 17);	CFStreamClientContext context = { 0, responseData, NULL, NULL, NULL };	if(!CFReadStreamSetClient(stream, kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable | kCFStreamEventEndEncountered | kCFStreamEventErrorOccurred, &IPStreamCallback, &context))	{		CFRelease(stream);		publicIPState = IPStateInvalid;		return;	}	// Add to the run loop and open the stream	CFReadStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);	if(!CFReadStreamOpen(stream))	{		CFReadStreamSetClient(stream, 0, NULL, NULL);		CFReadStreamUnscheduleFromRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);		CFRelease(stream);		publicIPState = IPStateInvalid;		return;	}	// Run the run loop	do {		CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, TRUE);	} while(publicIPState == IPStateFetching);}
开发者ID:JustSid,项目名称:extip,代码行数:58,


示例16: method_play_file

static VALUE method_play_file(VALUE self, VALUE filename) {  playFile(StringValuePtr(filename));  struct timeval wait;  wait.tv_sec=0;  wait.tv_usec=100*1000;  do {    CHECK_INTS;    CFRunLoopRunInMode (kCFRunLoopDefaultMode,                        0.25,                        false);  } while (aqData.mIsRunning);  CFRunLoopRunInMode(kCFRunLoopDefaultMode,                     1,                     false);  free_aqData();  return Qnil;}
开发者ID:jtimberman,项目名称:dhun,代码行数:18,


示例17: fxRunLoop

void fxRunLoop(txMachine* the){#if mxMacOSX	SInt32 reason;	do {		reason = CFRunLoopRunInMode(gxRunLoopMode, 1, false);	} while (reason == kCFRunLoopRunTimedOut);#endif}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:9,


示例18: SDL_SYS_JoystickDetect

/* Function to cause any queued joystick insertions to be processed */voidSDL_SYS_JoystickDetect(){    while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {        /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */    }    if (s_bDeviceAdded || s_bDeviceRemoved) {        recDevice *device = gpDeviceList;        s_bDeviceAdded = SDL_FALSE;        s_bDeviceRemoved = SDL_FALSE;        int device_index = 0;        /* send notifications */        while (device) {            if (device->send_open_event) {                device->send_open_event = 0;/* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceAdded()? */#if !SDL_EVENTS_DISABLED                SDL_Event event;                event.type = SDL_JOYDEVICEADDED;                if (SDL_GetEventState(event.type) == SDL_ENABLE) {                    event.jdevice.which = device_index;                    if ((SDL_EventOK == NULL)                        || (*SDL_EventOK) (SDL_EventOKParam, &event)) {                        SDL_PushEvent(&event);                    }                }#endif /* !SDL_EVENTS_DISABLED */            }            if (device->removed) {                const int instance_id = device->instance_id;                device = FreeDevice(device);/* !!! FIXME: why isn't there an SDL_PrivateJoyDeviceRemoved()? */#if !SDL_EVENTS_DISABLED                SDL_Event event;                event.type = SDL_JOYDEVICEREMOVED;                if (SDL_GetEventState(event.type) == SDL_ENABLE) {                    event.jdevice.which = instance_id;                    if ((SDL_EventOK == NULL)                        || (*SDL_EventOK) (SDL_EventOKParam, &event)) {                        SDL_PushEvent(&event);                    }                }#endif /* !SDL_EVENTS_DISABLED */            } else {                device = device->pNext;                device_index++;            }        }    }}
开发者ID:ArkyRomania,项目名称:ufoai,代码行数:59,


示例19: USE

HRESULT WebKitMessageLoop::performMessageLoopTasks(){#if USE(CF)    CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);#endif#if USE(GLIB)    g_main_context_iteration(0, false);#endif    return S_OK;}
开发者ID:clbr,项目名称:webkitfltk,代码行数:10,


示例20: Gamepad_init

void Gamepad_init() {  if (hidManager == NULL) {    CFStringRef keys[2];    int value;    CFNumberRef values[2];    CFDictionaryRef dictionaries[3];    CFArrayRef array;		    hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);		    keys[0] = CFSTR(kIOHIDDeviceUsagePageKey);    keys[1] = CFSTR(kIOHIDDeviceUsageKey);		    value = kHIDPage_GenericDesktop;    values[0] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);    value = kHIDUsage_GD_Joystick;    values[1] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);    dictionaries[0] = CFDictionaryCreate(kCFAllocatorDefault, (const void **) keys, (const void **) values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFRelease(values[0]);    CFRelease(values[1]);		    value = kHIDPage_GenericDesktop;    values[0] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);    value = kHIDUsage_GD_GamePad;    values[1] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);    dictionaries[1] = CFDictionaryCreate(kCFAllocatorDefault, (const void **) keys, (const void **) values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFRelease(values[0]);    CFRelease(values[1]);		    value = kHIDPage_GenericDesktop;    values[0] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);    value = kHIDUsage_GD_MultiAxisController;    values[1] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);    dictionaries[2] = CFDictionaryCreate(kCFAllocatorDefault, (const void **) keys, (const void **) values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFRelease(values[0]);    CFRelease(values[1]);		    array = CFArrayCreate(kCFAllocatorDefault, (const void **) dictionaries, 3, &kCFTypeArrayCallBacks);    CFRelease(dictionaries[0]);    CFRelease(dictionaries[1]);    CFRelease(dictionaries[2]);    IOHIDManagerSetDeviceMatchingMultiple(hidManager, array);    CFRelease(array);		    IOHIDManagerRegisterDeviceMatchingCallback(hidManager, onDeviceMatched, NULL);    IOHIDManagerRegisterDeviceRemovalCallback(hidManager, onDeviceRemoved, NULL);		    IOHIDManagerOpen(hidManager, kIOHIDOptionsTypeNone);		    // Force gamepads to be recognized immediately. The normal run loop mode takes a few frames,    // but we can run one iteration with a custom mode to do it without a delay.    IOHIDManagerScheduleWithRunLoop(hidManager, CFRunLoopGetCurrent(), GAMEPAD_RUN_LOOP_MODE);    CFRunLoopRunInMode(GAMEPAD_RUN_LOOP_MODE, 0, true);  }}
开发者ID:Shirakumo,项目名称:libstem_gamepad,代码行数:55,


示例21: LOG

void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& vector){    LOG(Network, "ResourceHandle::loadResourceSynchronously:%s allowStoredCredentials:%u", request.url().string().utf8().data(), storedCredentials);    ASSERT(!request.isEmpty());    ASSERT(response.isNull());    ASSERT(error.isNull());    OwnPtr<WebCoreSynchronousLoaderClient> client = WebCoreSynchronousLoaderClient::create(response, error);    client->setAllowStoredCredentials(storedCredentials == AllowStoredCredentials);    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));    handle->d->m_storageSession = context->storageSession();    if (handle->d->m_scheduledFailureType != NoFailure) {        error = context->blockedError(request);        return;    }    handle->createCFURLConnection(storedCredentials == AllowStoredCredentials, shouldRelaxThirdPartyCookiePolicy(context, request.url()), ResourceHandle::shouldContentSniffURL(request.url()));    CFURLConnectionScheduleWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), synchronousLoadRunLoopMode());    CFURLConnectionScheduleDownloadWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), synchronousLoadRunLoopMode());    CFURLConnectionStart(handle->connection());    while (!client->isDone())        CFRunLoopRunInMode(synchronousLoadRunLoopMode(), UINT_MAX, true);    CFURLConnectionCancel(handle->connection());    if (error.isNull() && response.mimeType().isNull())        setDefaultMIMEType(response.cfURLResponse());    RetainPtr<CFDataRef> data = client->data();    if (!error.isNull()) {        response = ResourceResponse(request.url(), String(), 0, String(), String());        CFErrorRef cfError = error;        CFStringRef domain = CFErrorGetDomain(cfError);        // FIXME: Return the actual response for failed authentication.        if (domain == kCFErrorDomainCFNetwork)            response.setHTTPStatusCode(CFErrorGetCode(cfError));        else            response.setHTTPStatusCode(404);    }    if (data) {        ASSERT(vector.isEmpty());        vector.append(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get()));    }}
开发者ID:kcomkar,项目名称:webkit,代码行数:54,


示例22: OSX_Mouse_Thread

static int OSX_Mouse_Thread(void *ctx){	if (!ctx)		return 0;	struct osx_mouse_data *mdata = static_cast<struct osx_mouse_data *>(ctx);		IOHIDManagerRef hid_manager = IOHIDManagerCreate(kCFAllocatorSystemDefault, kIOHIDOptionsTypeNone);	if (!hid_manager) {		SDL_DestroyMutex(mdata->mouse_mutex);		delete mdata;		return 0;	}		if (IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {		CFRelease(hid_manager);		SDL_DestroyMutex(mdata->mouse_mutex);		delete mdata;		return 0;	}		IOHIDManagerRegisterInputValueCallback(hid_manager, input_callback, mdata);	IOHIDManagerScheduleWithRunLoop(hid_manager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);			uint32_t page = kHIDPage_GenericDesktop;	uint32_t usage = kHIDUsage_GD_Mouse;	CFDictionaryRef dict = NULL;	CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);	CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);	const void *keys[2] = { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) };	const void *vals[2] = { pageNumRef, usageNumRef };	if (pageNumRef && usageNumRef)		dict = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	if (pageNumRef)		CFRelease(pageNumRef);	if (usageNumRef)		CFRelease(usageNumRef);	IOHIDManagerSetDeviceMatching(hid_manager, dict);	if (dict)		CFRelease(dict);	while (!mdata->should_exit) {		CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, false);	}	IOHIDManagerUnscheduleFromRunLoop(hid_manager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);	IOHIDManagerClose(hid_manager, kIOHIDOptionsTypeNone);		CFRelease(hid_manager);	SDL_DestroyMutex(mdata->mouse_mutex);	delete mdata;	return 0;}
开发者ID:blezek,项目名称:marathon-ios,代码行数:53,


示例23: ParkEventLoop

static void ParkEventLoop() {    // RunLoop needs at least one source, and 1e20 is pretty far into the future    CFRunLoopTimerRef t = CFRunLoopTimerCreate(kCFAllocatorDefault, 1.0e20, 0.0, 0, 0, dummyTimer, NULL);    CFRunLoopAddTimer(CFRunLoopGetCurrent(), t, kCFRunLoopDefaultMode);    CFRelease(t);    // Park this thread in the main run loop.    int32_t result;    do {        result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, false);    } while (result != kCFRunLoopRunFinished);}
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:12,


示例24: memset

    ~TestProxy()    {      IMessageQueue::size_type count = 0;#ifdef _WIN32      BOOL result = 0;      MSG msg;      memset(&msg, 0, sizeof(msg));      while ((result = ::GetMessage(&msg, NULL, 0, 0)) != 0)      {        BOOST_CHECK(-1 != result)        ::TranslateMessage(&msg);        ::DispatchMessage(&msg);        count = mThread->getTotalUnprocessedMessages();        count += mThread->getTotalUnprocessedMessages();        if (0 == count)          break;        memset(&msg, 0, sizeof(msg));      }#elif __APPLE__        count = mThread->getTotalUnprocessedMessages();        do        {            //Run loop to handle sources            CFRunLoopRunInMode(kCFRunLoopDefaultMode,1,false);            count = mThread->getTotalUnprocessedMessages();        } while (count > 0);#else      do      {        count = mThread->getTotalUnprocessedMessages();        count += mThreadNeverCalled->getTotalUnprocessedMessages();        if (0 != count)          boost::this_thread::yield();      } while (count > 0);#endif //_WIN32      BOOST_EQUAL(0, mThread->getTotalUnprocessedMessages());      BOOST_EQUAL(0, mThreadNeverCalled->getTotalUnprocessedMessages());      mThread->waitForShutdown();      mThreadNeverCalled->waitForShutdown();      BOOST_EQUAL(getCheck().mCalledFunc3, "func3");      BOOST_EQUAL(getCheck().mCalledFunc2, 1000);      BOOST_CHECK(getCheck().mCalledFunc1);      BOOST_CHECK(getCheck().mDestroyedTestProxyCallback);    }
开发者ID:liutao6982,项目名称:zsLib,代码行数:53,


示例25: DASessionScheduleWithRunLoop

void QDeviceWatcherPrivate::run(){    mStop = false;    DASessionScheduleWithRunLoop(mSession, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);    SInt32 result;    do {        result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, true);    } while (!mStop && result);    DASessionUnscheduleFromRunLoop(mSession, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);}
开发者ID:DobotTeam,项目名称:Dobot_for_Developers,代码行数:12,


示例26: main

int main(int argc, char **argv){	vuoInit(argc, argv);	char *outputPath = getenv("TESTVUORUNNER_OUTPUTPATH");	file = fopen(outputPath, "a");	fprintf(file, "started/n");	while (! isStopped)		CFRunLoopRunInMode(kCFRunLoopDefaultMode,0.01,false);	return 0;}
开发者ID:bboylalu,项目名称:vuo,代码行数:12,


示例27: Pt_Thread

static void* Pt_Thread(void *p){    CFTimeInterval timerInterval;    CFRunLoopTimerContext timerContext;    CFRunLoopTimerRef timer;    PtThreadParams *params = (PtThreadParams*)p;    //CFTimeInterval timeout;    /* raise the thread's priority */    kern_return_t error;    thread_extended_policy_data_t extendedPolicy;    thread_precedence_policy_data_t precedencePolicy;    extendedPolicy.timeshare = 0;    error = thread_policy_set(mach_thread_self(), THREAD_EXTENDED_POLICY,                              (thread_policy_t)&extendedPolicy,                              THREAD_EXTENDED_POLICY_COUNT);    if (error != KERN_SUCCESS) {        mach_error("Couldn't set thread timeshare policy", error);    }    precedencePolicy.importance = THREAD_IMPORTANCE;    error = thread_policy_set(mach_thread_self(), THREAD_PRECEDENCE_POLICY,                              (thread_policy_t)&precedencePolicy,                              THREAD_PRECEDENCE_POLICY_COUNT);    if (error != KERN_SUCCESS) {        mach_error("Couldn't set thread precedence policy", error);    }    /* set up the timer context */    timerContext.version = 0;    timerContext.info = params;    timerContext.retain = NULL;    timerContext.release = NULL;    timerContext.copyDescription = NULL;    /* create a new timer */    timerInterval = (double)params->resolution / 1000.0;    timer = CFRunLoopTimerCreate(NULL, startTime+timerInterval, timerInterval,                                 0, 0, Pt_CFTimerCallback, &timerContext);    timerRunLoop = CFRunLoopGetCurrent();    CFRunLoopAddTimer(timerRunLoop, timer, CFSTR("PtTimeMode"));    /* run until we're told to stop by Pt_Stop() */    CFRunLoopRunInMode(CFSTR("PtTimeMode"), LONG_TIME, false);        CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), timer, CFSTR("PtTimeMode"));    CFRelease(timer);    free(params);    return NULL;}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:53,


示例28: Gamepad_detectDevices

void Gamepad_detectDevices() {  unsigned int eventIndex;	  if (hidManager == NULL) {    return;  }	  CFRunLoopRunInMode(GAMEPAD_RUN_LOOP_MODE, 0, true);  for (eventIndex = 0; eventIndex < deviceEventCount; eventIndex++) {    processQueuedEvent(deviceEventQueue[eventIndex]);  }  deviceEventCount = 0;}
开发者ID:Shirakumo,项目名称:libstem_gamepad,代码行数:13,



注:本文中的CFRunLoopRunInMode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CFRunLoopSourceSignal函数代码示例
C++ CFRunLoopRun函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。