本文整理匯總了C++中CFRunLoopStop函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFRunLoopStop函數的具體用法?C++ CFRunLoopStop怎麽用?C++ CFRunLoopStop使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFRunLoopStop函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: hid_device_removal_callback
static void hid_device_removal_callback(void *context, IOReturn result,
void *sender)
{
/* Stop the Run Loop for this device. */
hid_device *d = context;
d->disconnected = 1;
CFRunLoopStop(d->run_loop);
}
示例2: CFRunLoopStop
static PyObject *pypowerobserver_stop(PyPowerObserver *self,
PyObject *args,
PyObject *kwargs)
{
CFRunLoopStop(self->runLoop);
Py_INCREF(Py_None);
return Py_None;
}
示例3: CFRunLoopStop
void HIDDevice::stop(void)
{
if ( cfRunLoop ) {
CFRunLoopStop ( cfRunLoop ) ;
Threads::Mutex::Lock stateLock ( runLoopMutex ) ;
(*hidQueueInterface) -> stop ( hidQueueInterface ) ;
stopDeviceThread ( ) ;
}
}
示例4: sectask_server_request
kern_return_t sectask_server_request(mach_port_t receiver,
audit_token_t auditToken)
{
memcpy(&g_self_audittoken, &auditToken, sizeof(g_self_audittoken));
CFRunLoopStop(CFRunLoopGetCurrent());
return 0;
}
示例5: timeout_cb
static void timeout_cb(CFRunLoopTimerRef timer, void *context)
{
(void) timer;
bool *timed_out = (bool *) context;
*timed_out = true;
CFRunLoopStop(CFRunLoopGetCurrent());
}
示例6: btpad_close_all_connections
static void btpad_close_all_connections(void)
{
int i;
for (i = 0; i < MAX_USERS; i ++)
btpad_close_connection(&g_connections[i]);
/* TODO/FIXME - create platform-agnostic solution for this
* and figure out why/if this is needed. */
CFRunLoopStop(CFRunLoopGetCurrent());
}
示例7: _stream_handler
static void
_stream_handler(ConstFSEventStreamRef stream,
void *info,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
{
const char **paths = eventPaths;
streamobject *object = info;
PyObject *result = NULL, *str = NULL, *num = NULL;
assert(numEvents <= PY_SSIZE_T_MAX);
PyGILState_STATE gil_state = PyGILState_Ensure();
PyThreadState *thread_state = PyThreadState_Swap(object->state);
/* Convert event data to Python objects */
PyObject *event_paths = PyList_New(numEvents);
if (!event_paths) {
goto final;
}
PyObject *event_flags = PyList_New(numEvents);
if (!event_flags) {
goto final;
}
for (size_t i = 0; i < numEvents; i++) {
str = PyBytes_FromString(paths[i]);
#if PY_MAJOR_VERSION >= 3
num = PyLong_FromLong(eventFlags[i]);
#else
num = PyInt_FromLong(eventFlags[i]);
#endif
if ((!num) || (!str)) {
goto final;
}
PyList_SET_ITEM(event_paths, i, str);
PyList_SET_ITEM(event_flags, i, num);
}
str = NULL;
num = NULL;
if ( (result = PyObject_CallFunctionObjArgs(
object->callback, event_paths, event_flags, NULL)) == NULL) {
/* May can return NULL if an exception is raised */
if (!PyErr_Occurred())
PyErr_SetString(PyExc_ValueError, callback_error_msg);
/* Stop listening */
CFRunLoopStop(object->loop);
}
final:
示例8: output_callback
static void output_callback(hid_t *context, IOReturn ret, void *sender, IOHIDReportType type, uint32_t id, uint8_t *data, CFIndex len)
{
printf("output_callback, r=%d\n", ret);
if (ret == kIOReturnSuccess) {
*(int *)context = len;
} else {
// timeout if not success?
*(int *)context = 0;
}
CFRunLoopStop(CFRunLoopGetCurrent());
}
示例9: locker
void QFSEventsFileSystemWatcherEngine::stop()
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
QMutexLocker locker(&mutex);
stopFSStream(fsStream);
if (threadsRunLoop) {
CFRunLoopStop(threadsRunLoop);
waitForStop.wait(&mutex);
}
#endif
}
示例10: btpad_close_all_connections
static void btpad_close_all_connections(void)
{
unsigned i;
for (i = 0; i < MAX_USERS; i ++)
btpad_close_connection(&g_connections[i]);
#ifdef __APPLE__
CFRunLoopStop(CFRunLoopGetCurrent());
#endif
}
示例11: pyfsevents_stop
static PyObject* pyfsevents_stop(PyObject* self, PyObject* thread) {
PyObject* value = PyDict_GetItem(loops, thread);
CFRunLoopRef loop = PyCObject_AsVoidPtr(value);
/* stop runloop */
if (loop) {
CFRunLoopStop(loop);
}
Py_INCREF(Py_None);
return Py_None;
}
示例12: fse_pipe_callback
static void fse_pipe_callback(CFFileDescriptorRef fdref,
CFOptionFlags callBackTypes, void *info)
{
w_root_t *root = info;
unused_parameter(fdref);
unused_parameter(callBackTypes);
unused_parameter(root);
w_log(W_LOG_DBG, "pipe signalled\n");
CFRunLoopStop(CFRunLoopGetCurrent());
}
示例13: GotPacket
static Boolean GotPacket(ConnectionRef conn, const PacketHeader *packet, void *refCon)
// DoListen registers this routine with the connection abstraction layer
// so that it is called when a packet arrives. For a description of the
// parameters, see the comments next to ConnectionCallbackProcPtr.
{
#pragma unused(conn)
Boolean result;
CFRunLoopRef runLoop;
// When we register this callback, we pass a reference to the runloop
// as the refCon. Extract that reference here.
runLoop = (CFRunLoopRef) refCon;
assert(runLoop != NULL);
assert( CFGetTypeID(runLoop) == CFRunLoopGetTypeID() );
result = true;
if (packet == NULL) {
// Server connection has gone away. No need to return false because
// the connection is torn anyway.
CFRunLoopStop(runLoop);
} else {
// We got a packet from the server. Tell the user about it.
switch (packet->fType) {
case kPacketTypeShout:
if (packet->fSize != sizeof(PacketShout)) {
fprintf(stderr, "GotPacket: Server sent us a Shout with the wrong size (%" PRIu32 ").\n", packet->fSize);
result = false;
}
if (result && (packet->fID != kPacketIDNone) ) {
fprintf(stderr, "GotPacket: Server sent us a Shout with the wrong size (%" PRId32 ").\n", packet->fID);
result = false;
}
if (result) {
PacketShout * shoutPacket;
shoutPacket = (PacketShout *) packet;
fprintf(stderr, "%*s heard \"%.*s\"\n", kResultColumnWidth, "", (int) sizeof(shoutPacket->fMessage), shoutPacket->fMessage);
}
break;
default:
fprintf(stderr, "GotPacket: Server sent us a packet with an unexpected type (%.4s).\n", (char *) &packet->fType);
result = false;
break;
}
}
return result;
}
示例14: usb_cleanup
void usb_cleanup()
{
DBG("usb_cleanup\n");
close_usb_devices();
if (currentRunLoop)
CFRunLoopStop(currentRunLoop);
if (notificationIterators != NULL) {
free(notificationIterators);
notificationIterators = NULL;
}
}
示例15: PsychHIDOSKbQueueRelease
void PsychHIDOSKbQueueRelease(int deviceIndex)
{
// Get true keyboardqueue index assigned to deviceIndex from original user provided deviceIndex:
deviceIndex = PsychHIDOSGetKbQueueDevice(deviceIndex, NULL);
// Keyboard queue for this deviceIndex already exists?
if (NULL == psychHIDKbQueueFirstPress[deviceIndex]) {
// No. Nothing to do then.
return;
}
// Ok, we have a keyboard queue. Stop any operation on it first:
PsychHIDOSKbQueueStop(deviceIndex);
// The mutex will be automatically unlocked and destroyed by the CFRunLoop thread
// so it isn't even declared in this routine
if (psychHIDKbQueueCFRunLoopRef[deviceIndex]) {
// Shutdown the processing thread for this queue:
PsychLockMutex(&KbQueueMutex);
// Stop the CFRunLoop, which will allow its associated thread to exit:
CFRunLoopStop(psychHIDKbQueueCFRunLoopRef[deviceIndex]);
// Done.
PsychUnlockMutex(&KbQueueMutex);
// Shutdown the thread, wait for its termination:
PsychDeleteThread(&KbQueueThread[deviceIndex]);
KbQueueThread[deviceIndex] = NULL;
// Release the CFRunLoop for this queue:
CFRelease(psychHIDKbQueueCFRunLoopRef[deviceIndex]);
psychHIDKbQueueCFRunLoopRef[deviceIndex] = NULL;
// Release queue object:
CFRelease(queue[deviceIndex]);
queue[deviceIndex] = NULL;
}
// Release its data structures:
free(psychHIDKbQueueFirstPress[deviceIndex]); psychHIDKbQueueFirstPress[deviceIndex] = NULL;
free(psychHIDKbQueueFirstRelease[deviceIndex]); psychHIDKbQueueFirstRelease[deviceIndex] = NULL;
free(psychHIDKbQueueLastPress[deviceIndex]); psychHIDKbQueueLastPress[deviceIndex] = NULL;
free(psychHIDKbQueueLastRelease[deviceIndex]); psychHIDKbQueueLastRelease[deviceIndex] = NULL;
free(psychHIDKbQueueScanKeys[deviceIndex]); psychHIDKbQueueScanKeys[deviceIndex] = NULL;
// Release kbqueue event buffer:
PsychHIDDeleteEventBuffer(deviceIndex);
// Done.
return;
}