本文整理匯總了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);
}
示例2: locker
void WatcherThread::stop()
{
MutexLocker locker(&mutex);
flags |= Stop;
CFRunLoopSourceSignal(source);
CFRunLoopWakeUp(loop);
}
示例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;
}
示例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 */
}
}
示例5: CFRunLoopSourceSignal
void wxApp::WakeUpIdle()
{
#ifdef __WXMAC_OSX__
if (m_macEventPosted)
{
CFRunLoopSourceSignal(m_macEventPosted);
}
#endif
wxMacWakeUp() ;
}
示例6: CFSocketDispatchWriteEvent
static void
CFSocketDispatchWriteEvent(void* p)
{
CFSocketRef socket = (CFSocketRef) p;
CFRunLoopSourceRef src = socket->_source;
socket->_writeFired = true;
if (src != NULL)
CFRunLoopSourceSignal(src);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
}
示例11: DAStageSignal
void DAStageSignal( void )
{
/*
* Signal DAStage.
*/
if ( gDAIdle )
{
___vproc_transaction_begin( );
}
gDAIdle = FALSE;
CFRunLoopSourceSignal( __gDAStageRunLoopSource );
}
示例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;
}
}
示例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);
}
示例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);
}
示例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
}