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


C++ CFRunLoopSourceSignal函数代码示例

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


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

示例1: AddToMessageQueue

void AddToMessageQueue(CFTypeRef objectToAdd)
{
    int pthreadError;
    
    // take the lock on the message queue
    pthreadError = pthread_mutex_lock(&queueLock);
    if (pthreadError) {
#if DEBUG
        printf("AddToMessageQueue: pthread_mutex_lock failed (%d)\n", pthreadError);
#endif
        return;        
    }
    
    // add the object to the queue
    CFArrayAppendValue(queueArray, objectToAdd);

    // release the lock
    pthreadError = pthread_mutex_unlock(&queueLock);
    if (pthreadError) {
#if DEBUG
        printf("AddToMessageQueue: pthread_mutex_unlock failed (%d)\n", pthreadError);
#endif
        return;
    }
    
    // signal the run loop source, so it runs
    CFRunLoopSourceSignal(runLoopSource);
    // and make sure the run loop wakes up right away (otherwise it may take a few seconds)
    CFRunLoopWakeUp(mainThreadRunLoop);
}
开发者ID:AmesianX,项目名称:MIDIApps,代码行数:30,代码来源:MessageQueue.c

示例2: locker

void WatcherThread::stop()
{
    MutexLocker locker(&mutex);
    flags |= Stop;
    CFRunLoopSourceSignal(source);
    CFRunLoopWakeUp(loop);
}
开发者ID:Andersbakken,项目名称:rtags-old-branches,代码行数:7,代码来源:FileSystemWatcher_fsevents.cpp

示例3: rlsCallback

static void
rlsCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
{
	mach_no_senders_notification_t	*buf		= msg;
	mach_msg_id_t			msgid		= buf->not_header.msgh_id;
	SCDynamicStoreRef		store		= (SCDynamicStoreRef)info;
	SCDynamicStorePrivateRef	storePrivate	= (SCDynamicStorePrivateRef)store;

	if (msgid == MACH_NOTIFY_NO_SENDERS) {
		/* the server died, disable additional callbacks */
#ifdef	DEBUG
		SCLog(_sc_verbose, LOG_INFO, CFSTR("  rlsCallback(), notifier port closed"));
#endif	/* DEBUG */

#ifdef	DEBUG
		if (port != storePrivate->rlsNotifyPort) {
			SCLog(_sc_verbose, LOG_DEBUG, CFSTR("rlsCallback(), why is port != rlsNotifyPort?"));
		}
#endif	/* DEBUG */

		/* re-establish notification and inform the client */
		(void)__SCDynamicStoreReconnectNotifications(store);
	}

	/* signal the real runloop source */
	if (storePrivate->rls != NULL) {
		CFRunLoopSourceSignal(storePrivate->rls);
	}
	return;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:30,代码来源:SCDNotifierInformViaCallback.c

示例4: while

/*
 * rend_pipe_monitor
 */
void *rend_pipe_monitor(void* arg) {
    fd_set rset;
    int result;


    while(1) {
	DPRINTF(E_DBG,L_REND,"Waiting for data\n");
	FD_ZERO(&rset);
	FD_SET(rend_pipe_to[RD_SIDE],&rset);

	/* sit in a select spin until there is data on the to fd */
	while(((result=select(rend_pipe_to[RD_SIDE] + 1,&rset,NULL,NULL,NULL)) != -1) &&
	    errno != EINTR) {
	    if(FD_ISSET(rend_pipe_to[RD_SIDE],&rset)) {
		DPRINTF(E_DBG,L_REND,"Received a message from daap server\n");
		CFRunLoopSourceSignal(rend_rls);
		CFRunLoopWakeUp(rend_runloop);
		sleep(1);  /* force a reschedule, hopefully */
	    }
	}

	DPRINTF(E_DBG,L_REND,"Select error!\n");
	/* should really bail here */
    }
}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:28,代码来源:rend-osx.c

示例5: CFRunLoopSourceSignal

void wxApp::WakeUpIdle()
{
#ifdef __WXMAC_OSX__
    if (m_macEventPosted)
    {
        CFRunLoopSourceSignal(m_macEventPosted);
    }
#endif
    wxMacWakeUp() ;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:10,代码来源:app.cpp

示例6: CFSocketDispatchWriteEvent

static void
CFSocketDispatchWriteEvent(void* p)
{
  CFSocketRef socket = (CFSocketRef) p;
  CFRunLoopSourceRef src = socket->_source;
  
  socket->_writeFired = true;
  
  if (src != NULL)
    CFRunLoopSourceSignal(src);
}
开发者ID:1053948334,项目名称:myos.frameworks,代码行数:11,代码来源:CFSocket.c

示例7: l

void HostDnsServiceDarwin::monitorThreadShutdown()
{
    ALock l(this);
    if (!m->m_fStop)
    {
        CFRunLoopSourceSignal(m->m_Stopper);
        CFRunLoopWakeUp(m->m_RunLoopRef);

        RTSemEventWait(m->m_evtStop, RT_INDEFINITE_WAIT);
    }
}
开发者ID:mcenirm,项目名称:vbox,代码行数:11,代码来源:HostDnsServiceDarwin.cpp

示例8: Tcl_AlertNotifier

void
Tcl_AlertNotifier(
    ClientData clientData)
{
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;

    LOCK_NOTIFIER;
    if (tsdPtr->runLoop) {
	tsdPtr->eventReady = 1;
	CFRunLoopSourceSignal(tsdPtr->runLoopSource);
	CFRunLoopWakeUp(tsdPtr->runLoop);
    }
    UNLOCK_NOTIFIER;
}
开发者ID:aosm,项目名称:tcl,代码行数:14,代码来源:tclMacOSXNotify.c

示例9: hid_removal_callback

static void hid_removal_callback(void *ctx, IOReturn result, void *sender)
{
    _HS_UNUSED(result);
    _HS_UNUSED(sender);

    hs_port *port = ctx;

    pthread_mutex_lock(&port->u.hid->mutex);
    port->u.hid->device_removed = true;
    CFRunLoopSourceSignal(port->u.hid->shutdown_source);
    pthread_mutex_unlock(&port->u.hid->mutex);

    fire_device_event(port);
}
开发者ID:Koromix,项目名称:ty,代码行数:14,代码来源:hid_darwin.c

示例10: btstack_set_poweron

void btstack_set_poweron(bool on)
{
   if (!btstack_try_load())
      return;

   if (on && !btstack_thread)
      pthread_create(&btstack_thread, 0, btstack_thread_func, 0);
   else if (!on && btstack_thread && btstack_quit_source)
   {
      CFRunLoopSourceSignal(btstack_quit_source);
      pthread_join(btstack_thread, 0);
      btstack_thread = 0;
   }
}
开发者ID:Mbcpro,项目名称:RetroArch,代码行数:14,代码来源:btdynamic.c

示例11: DAStageSignal

void DAStageSignal( void )
{
    /*
     * Signal DAStage.
     */

    if ( gDAIdle )
    {
        ___vproc_transaction_begin( );
    }

    gDAIdle = FALSE;

    CFRunLoopSourceSignal( __gDAStageRunLoopSource );
}
开发者ID:alexzhang2015,项目名称:osx-10.9,代码行数:15,代码来源:DAStage.c

示例12: btstack_set_poweron

static void btstack_set_poweron(bool on)
{
   if (!btstack_try_load())
      return;

   if (on && !btstack_thread)
      btstack_thread = sthread_create(btstack_thread_func, NULL);
   else if (!on && btstack_thread && btstack_quit_source)
   {
#ifdef __APPLE__
      CFRunLoopSourceSignal(btstack_quit_source);
#endif
      sthread_join(btstack_thread);
      btstack_thread = NULL;
   }
}
开发者ID:matthijsberk,项目名称:RetroArch,代码行数:16,代码来源:btstack_hid.c

示例13: PushExitCommand

void DeviceManagerThread::Shutdown()
{
    // Push for thread shutdown *WITH NO WAIT*.
    // This will have the following effect:
    //  - Exit command will get enqueued, which will be executed later on the thread itself.
    //  - Beyond this point, this DeviceManager object may be deleted by our caller.
    //  - Other commands, such as CreateDevice, may execute before ExitCommand, but they will
    //    fail gracefully due to pLock->pManager == 0. Future commands can't be enqued
    //    after pManager is null.
    //  - Once ExitCommand executes, ThreadCommand::Run loop will exit and release the last
    //    reference to the thread object.
    PushExitCommand(false);

    // make sure CFRunLoopRunInMode is woken up
    CFRunLoopSourceSignal(CommandQueueSource);
    CFRunLoopWakeUp(RunLoop);
}
开发者ID:123woodman,项目名称:minko,代码行数:17,代码来源:OVR_OSX_DeviceManager.cpp

示例14: hid_close

void HID_API_EXPORT hid_close(hid_device *dev)
{
	if ( !dev )
	{
		return;
	}

	/* Disconnect the report callback before close. */
	if (!dev->disconnected) {
		IOHIDDeviceRegisterInputReportCallback(
			dev->device_handle, dev->input_report_buf, dev->max_input_report_len,
			NULL, dev);
		IOHIDManagerRegisterDeviceRemovalCallback(hid_mgr, NULL, dev);
		IOHIDDeviceUnscheduleFromRunLoop(dev->device_handle, dev->run_loop, dev->run_loop_mode);
		IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetMain(), kCFRunLoopDefaultMode);
	}
	
	/* Cause read_thread() to stop. */
	dev->shutdown_thread = 1;
	
	/* Wake up the run thread's event loop so that the thread can exit. */
	CFRunLoopSourceSignal(dev->source);
	CFRunLoopWakeUp(dev->run_loop);
	
	/* Notify the read thread that it can shut down now. */
	pthread_barrier_wait(&dev->shutdown_barrier);

	/* Wait for read_thread() to end. */
	pthread_join(dev->thread, NULL);

	/* Close the OS handle to the device, but only if it's not
	   been unplugged. If it's been unplugged, then calling
	   IOHIDDeviceClose() will crash. */
	if (!dev->disconnected) {
		IOHIDDeviceClose(dev->device_handle, kIOHIDOptionsTypeNone);
	}
	
	/* Clear out the queue of received reports. */
	pthread_mutex_lock(&dev->mutex);
	while (dev->input_reports) {
		return_data(dev, NULL, 0);
	}
	pthread_mutex_unlock(&dev->mutex);

	free_hid_device(dev);
}
开发者ID:jingoro2112,项目名称:dna,代码行数:46,代码来源:hid.c

示例15: fxQueuePromiseJobs

void fxQueuePromiseJobs(txMachine* the)
{
#if mxMacOSX
	CFRunLoopSourceContext context;
#endif
	txJob* job = malloc(sizeof(txJob));
	job->the = the;
	job->moduleID = XS_NO_ID;
#if mxMacOSX
	memset(&context, 0, sizeof(context));
	context.info = job;
	context.perform = fxPerformJob;
    job->source = CFRunLoopSourceCreate(kCFAllocatorDefault, 0, &context);
	CFRunLoopAddSource(CFRunLoopGetCurrent(), job->source, gxRunLoopMode);
	CFRunLoopSourceSignal(job->source);
#endif
}
开发者ID:kouis3940,项目名称:kinomajs,代码行数:17,代码来源:xs6Host.c


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