当前位置: 首页>>代码示例>>C++>>正文


C++ CFRunLoopRemoveSource函数代码示例

本文整理汇总了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);
}
开发者ID:a-page,项目名称:IOUSBFamily,代码行数:27,代码来源:main.c

示例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
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:27,代码来源:CocoaPowerSyscall.cpp

示例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 );
  }
}
开发者ID:VishalChandla,项目名称:midikit,代码行数:7,代码来源:cfintegration.c

示例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(&notifierObject);

	  // 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;
	}
    }
开发者ID:akoshelnik,项目名称:openvpn3,代码行数:25,代码来源:macsleep.hpp

示例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);
	}
}
开发者ID:Leon555,项目名称:Mac-src-essentials,代码行数:34,代码来源:mshow.c

示例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();
}
开发者ID:PoppySeedPlehzr,项目名称:osquery,代码行数:28,代码来源:iokit.cpp

示例7: xmmsc_mainloop_cf_shutdown

void
xmmsc_mainloop_cf_shutdown (xmmsc_connection_t *c, CFRunLoopSourceRef source)
{
	CFRunLoopRef runLoopRef = CFRunLoopGetCurrent ();

	CFRunLoopRemoveSource (runLoopRef, source, kCFRunLoopDefaultMode);
}
开发者ID:Malvineous,项目名称:xmms2-devel,代码行数:7,代码来源:xmmsclient-cf.c

示例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);
}
开发者ID:ecashin,项目名称:aoe-osx,代码行数:25,代码来源:AoEProperties.cpp

示例9: PortsCleanup

/* Cleanup of the open ports */
void PortsCleanup()
{
	CFRunLoopRemoveSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notifyPortRef), kCFRunLoopCommonModes);    /* Remove the notification port from the runloop */
	IODeregisterForSystemPower(&notifierObject);                                                                               /* Deregister from power notifications */
	IOServiceClose(root_power_port);                                                                                           /* Close the Root Power Domain IOService port */
	IONotificationPortDestroy(notifyPortRef);                                                                                  /* Destroy the notification port */
}
开发者ID:toshiya240,项目名称:DeepSleep,代码行数:8,代码来源:deepsleep.c

示例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;
        }
    }
}
开发者ID:hashier,项目名称:caffeinate_fix,代码行数:59,代码来源:upsd.c

示例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);
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:11,代码来源:qeventdispatcher_mac.cpp

示例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);
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:9,代码来源:gsockosx.cpp

示例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;
}
开发者ID:GaryHomewood,项目名称:supercollider-android-bootstrap,代码行数:10,代码来源:SC_ComPort.cpp

示例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);
}
开发者ID:bafomet,项目名称:iSCSIInitiator,代码行数:11,代码来源:iSCSIDaemon.c

示例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();
}
开发者ID:hgwells,项目名称:tive,代码行数:53,代码来源:app.cpp


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