本文整理匯總了C++中CFRunLoopRemoveSource函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFRunLoopRemoveSource函數的具體用法?C++ CFRunLoopRemoveSource怎麽用?C++ CFRunLoopRemoveSource使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFRunLoopRemoveSource函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: transferData
void transferData(IOUSBInterfaceInterface245 **intf, UInt8 inPipeRef, UInt8 outPipeRef)
{
IOReturn err;
CFRunLoopSourceRef cfSource;
int i;
err = (*intf)->CreateInterfaceAsyncEventSource(intf, &cfSource);
if (err)
{
printf("transferData: unable to create event source, err = %08x\n", err);
return;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), cfSource, kCFRunLoopDefaultMode);
for (i=0; i < 12; i++)
outBuf[i] = 'R';
err = (*intf)->WritePipeAsync(intf, outPipeRef, outBuf, 12, (IOAsyncCallback1)MyCallBackFunction, (void*)(UInt32)inPipeRef);
if (err)
{
printf("transferData: WritePipeAsyncFailed, err = %08x\n", err);
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), cfSource, kCFRunLoopDefaultMode);
return;
}
printf("transferData: calling CFRunLoopRun\n");
CFRunLoopRun();
printf("transferData: returned from CFRunLoopRun\n");
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), cfSource, kCFRunLoopDefaultMode);
}
示例2: CFRunLoopRemoveSource
void CCocoaPowerSyscall::DeleteOSPowerCallBacks(void)
{
#if !defined(TARGET_DARWIN_IOS)
CCocoaAutoPool autopool;
// we no longer want sleep/wake notifications
// remove the sleep notification port from the application runloop
CFRunLoopRemoveSource( CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(m_notify_port), kCFRunLoopDefaultMode );
// deregister for system sleep notifications
IODeregisterForSystemPower(&m_notifier_object);
// IORegisterForSystemPower implicitly opens the Root Power Domain IOService
// so we close it here
IOServiceClose(m_root_port);
// destroy the notification port allocated by IORegisterForSystemPower
IONotificationPortDestroy(m_notify_port);
// we no longer want power source change notifications
if (m_HasBattery)
{
if (m_power_source)
{
CFRunLoopRemoveSource( CFRunLoopGetCurrent(), m_power_source, kCFRunLoopDefaultMode );
CFRelease(m_power_source);
}
}
#endif
}
示例3: CFRunLoopRemoveMIDIRunLoopSource
void CFRunLoopRemoveMIDIRunLoopSource( CFRunLoopRef rl, struct CFMIDIRunLoopSource * source, CFStringRef mode ) {
int i;
if( source->cfrlt != NULL ) CFRunLoopRemoveTimer( rl, source->cfrlt, mode );
for( i=0; i<source->length; i++ ) {
if( source->cfrls[i] != NULL ) CFRunLoopRemoveSource( rl, source->cfrls[i], mode );
}
}
示例4: mac_sleep_stop
void mac_sleep_stop()
{
if (root_port)
{
// remove the sleep notification port from the application runloop
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(notifyPortRef),
kCFRunLoopCommonModes);
// deregister for system sleep notifications
IODeregisterForSystemPower(¬ifierObject);
// IORegisterForSystemPower implicitly opens the Root Power Domain IOService
// so we close it here
IOServiceClose(root_port);
// destroy the notification port allocated by IORegisterForSystemPower
IONotificationPortDestroy(notifyPortRef);
// reset object members
root_port = 0;
notifyPortRef = NULL;
notifierObject = 0;
}
}
示例5: socket_callback
/*
* CFRunloop callback that calls DNSServiceProcessResult() when
* there's new data on the socket.
*/
static void
socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void *data, void *context)
{
struct cbinfo *info = context;
DNSServiceErrorType err;
if (callbackType == kCFSocketNoCallBack) {
printf("socket_callback: kCFSocketNoCallBack?\n");
return;
}
if ((err = DNSServiceProcessResult(info->sdref)) != kDNSServiceErr_NoError) {
printf("DNSServiceProcessResult() returned an error! %d\n", err);
if (err == kDNSServiceErr_BadReference) {
printf("bad reference?: %p, %d, %p, %p %p\n", s, (int)callbackType, address, data, context);
return;
}
if ((context == &nfsinfo) || (context == &mountdinfo)) {
/* bail if there's a problem with the main browse connection */
exit(1);
}
/* dump the troublesome service connection */
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), info->rls, kCFRunLoopDefaultMode);
CFRelease(info->rls);
CFSocketInvalidate(info->sockref);
CFRelease(info->sockref);
DNSServiceRefDeallocate(info->sdref);
free(info);
}
}
示例6: lock
void IOKitEventPublisher::stop() {
if (run_loop_ == nullptr) {
// If there is no run loop then the publisher thread has not started.
return;
}
// Stop the run loop.
WriteLock lock(mutex_);
CFRunLoopStop(run_loop_);
// Stop the run loop before operating on containers.
// Destroy the IOPort.
if (port_ != nullptr) {
auto source = IONotificationPortGetRunLoopSource(port_);
if (CFRunLoopContainsSource(run_loop_, source, kCFRunLoopDefaultMode)) {
CFRunLoopRemoveSource(run_loop_, source, kCFRunLoopDefaultMode);
}
// And destroy the port.
IONotificationPortDestroy(port_);
port_ = nullptr;
}
// Clear all devices and their notifications.
for (const auto& device : devices_) {
IOObjectRelease(device->notification);
}
devices_.clear();
}
示例7: xmmsc_mainloop_cf_shutdown
void
xmmsc_mainloop_cf_shutdown (xmmsc_connection_t *c, CFRunLoopSourceRef source)
{
CFRunLoopRef runLoopRef = CFRunLoopGetCurrent ();
CFRunLoopRemoveSource (runLoopRef, source, kCFRunLoopDefaultMode);
}
示例8: IOIteratorNext
void AoEProperties::matched_callback(void* pRefcon, io_iterator_t iterator)
{
io_registry_entry_t Object = IOIteratorNext(iterator);
AoEProperties* pThis = (AoEProperties*) pRefcon;
if ( Object )
{
//debug("AOEINTERFACE ONLINE!\n");
if ( pThis )
pThis->m_fMatched = TRUE;
if ( pThis->m_OurObject )
IOObjectRelease(pThis->m_OurObject);
pThis->m_OurObject = Object;
// Since we have matched, we remove our source from the run loop
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), ms_IOKitNotificationRunLoopSource, kCFRunLoopDefaultMode);
}
// Empty the remaining devices in the list (don't release the iterator though, or we won't get our callback)
while( 0 != (Object=IOIteratorNext(iterator)) )
IOObjectRelease(Object);
}
示例9: PortsCleanup
/* Cleanup of the open ports */
void PortsCleanup()
{
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notifyPortRef), kCFRunLoopCommonModes); /* Remove the notification port from the runloop */
IODeregisterForSystemPower(¬ifierObject); /* Deregister from power notifications */
IOServiceClose(root_power_port); /* Close the Root Power Domain IOService port */
IONotificationPortDestroy(notifyPortRef); /* Destroy the notification port */
}
示例10: DeviceNotification
void DeviceNotification(void * refCon,
io_service_t service,
natural_t messageType,
void * messageArgument )
{
UPSDataRef upsDataRef = (UPSDataRef) refCon;
if ( (upsDataRef != NULL) &&
(messageType == kIOMessageServiceIsTerminated) )
{
upsDataRef->isPresent = FALSE;
SCDynamicStoreRemoveValue(upsDataRef->upsStore, upsDataRef->upsStoreKey);
if ( upsDataRef->upsEventSource )
{
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), upsDataRef->upsEventSource, kCFRunLoopDefaultMode);
CFRelease(upsDataRef->upsEventSource);
upsDataRef->upsEventSource = NULL;
}
if ( upsDataRef->upsEventTimer )
{
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), upsDataRef->upsEventTimer, kCFRunLoopDefaultMode);
CFRelease(upsDataRef->upsEventTimer);
upsDataRef->upsEventTimer = NULL;
}
if (upsDataRef->upsPlugInInterface != NULL)
{
(*(upsDataRef->upsPlugInInterface))->Release (upsDataRef->upsPlugInInterface);
upsDataRef->upsPlugInInterface = NULL;
}
if (upsDataRef->notification != MACH_PORT_NULL)
{
IOObjectRelease(upsDataRef->notification);
upsDataRef->notification = MACH_PORT_NULL;
}
if (upsDataRef->upsStoreKey)
{
CFRelease(upsDataRef->upsStoreKey);
upsDataRef->upsStoreKey = NULL;
}
if (upsDataRef->upsStoreDict)
{
CFRelease(upsDataRef->upsStoreDict);
upsDataRef->upsStoreDict = NULL;
}
if (upsDataRef->upsStore)
{
CFRelease(upsDataRef->upsStore);
upsDataRef->upsStore = NULL;
}
}
}
示例11: qt_mac_remove_socket_from_runloop
/*
Removes the loop source for the given socket from the current run loop.
*/
void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSourceRef runloop)
{
Q_ASSERT(runloop);
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), runloop, kCFRunLoopCommonModes);
CFSocketDisableCallBacks(socket, kCFSocketReadCallBack);
CFSocketDisableCallBacks(socket, kCFSocketWriteCallBack);
CFRunLoopSourceInvalidate(runloop);
}
示例12: _GSocket_Get_Mac_Socket
void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket)
{
struct MacGSocketData* data = _GSocket_Get_Mac_Socket(socket);
if (!data) return;
/* CFSocketInvalidate does CFRunLoopRemoveSource anyway */
CFRunLoopRemoveSource(s_mainRunLoop, data->source, kCFRunLoopCommonModes);
CFSocketInvalidate(data->socket);
}
示例13: CFMessagePortCreateRunLoopSource
void* SC_MachMessagePort::Run()
{
CFRunLoopSourceRef source = CFMessagePortCreateRunLoopSource(NULL, mServerPort, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
CFRunLoopRun();
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
CFRelease(source);
delete this;
return NULL;
}
示例14: iSCSIDDeregisterForPowerEvents
/*! Deregisters the daemon with the kernel to no longer receive power events. */
void iSCSIDDeregisterForPowerEvents()
{
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(powerNotifyPortRef),
kCFRunLoopDefaultMode);
IODeregisterForSystemPower(&powerNotifier);
IOServiceClose(powerPlaneRoot);
IONotificationPortDestroy(powerNotifyPortRef);
}
示例15: CFRunLoopRemoveSource
void wxApp::CleanUp()
{
#if wxUSE_TOOLTIPS
wxToolTip::RemoveToolTips() ;
#endif
#ifdef __WXMAC_OSX__
if (m_macEventPosted)
{
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
m_macEventPosted = NULL;
}
#endif
// One last chance for pending objects to be cleaned up
wxTheApp->DeletePendingObjects();
wxMacDestroyNotifierTable() ;
#ifndef __DARWIN__
# if __option(profile)
ProfilerDump( (StringPtr)"\papp.prof" ) ;
ProfilerTerm() ;
# endif
#endif
UMACleanupToolbox() ;
if (!sm_isEmbedded)
RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
if (!sm_isEmbedded)
{
AERemoveEventHandler( kCoreEventClass , kAEOpenDocuments ,
sODocHandler , FALSE ) ;
AERemoveEventHandler( kCoreEventClass , kAEOpenApplication ,
sOAppHandler , FALSE ) ;
AERemoveEventHandler( kCoreEventClass , kAEPrintDocuments ,
sPDocHandler , FALSE ) ;
AERemoveEventHandler( kCoreEventClass , kAEReopenApplication ,
sRAppHandler , FALSE ) ;
AERemoveEventHandler( kCoreEventClass , kAEQuitApplication ,
sQuitHandler , FALSE ) ;
DisposeAEEventHandlerUPP( sODocHandler ) ;
DisposeAEEventHandlerUPP( sOAppHandler ) ;
DisposeAEEventHandlerUPP( sPDocHandler ) ;
DisposeAEEventHandlerUPP( sRAppHandler ) ;
DisposeAEEventHandlerUPP( sQuitHandler ) ;
}
wxAppBase::CleanUp();
}