當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。