您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CFRunLoopRun函数代码示例

51自学网 2021-06-01 19:59:06
  C++
这篇教程C++ CFRunLoopRun函数代码示例写得很实用,希望能帮到您。

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

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

示例1: nc_watch

static voidnc_watch(int argc, char **argv){	SCNetworkConnectionStatus	status;	nc_create_connection(argc, argv, TRUE);	status = SCNetworkConnectionGetStatus(connection);	// report initial status	n_callback = 0;	nc_callback(connection, status, &n_callback);	// setup watcher	if (doDispatch) {		if (!SCNetworkConnectionSetDispatchQueue(connection, dispatch_get_main_queue())) {			SCPrint(TRUE, stderr, CFSTR("Unable to schedule watch process: %s/n"), SCErrorString(SCError()));			exit(1);		}	} else {		if (!SCNetworkConnectionScheduleWithRunLoop(connection, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {			SCPrint(TRUE, stderr, CFSTR("Unable to schedule watch process: %s/n"), SCErrorString(SCError()));			exit(1);		}	}	// wait for changes	CFRunLoopRun();	nc_release_connection();	exit(0);}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:32,


示例2: hostMonitoringRoutine

static int hostMonitoringRoutine(RTTHREAD ThreadSelf, void *pvUser){    NOREF(ThreadSelf);    NOREF(pvUser);    g_RunLoopRef = CFRunLoopGetCurrent();    AssertReturn(g_RunLoopRef, VERR_INTERNAL_ERROR);    CFRetain(g_RunLoopRef);    CFArrayRef watchingArrayRef = CFArrayCreate(NULL,                                                (const void **)&kStateNetworkGlobalDNSKey,                                                1, &kCFTypeArrayCallBacks);    if (!watchingArrayRef)    {        CFRelease(g_DnsWatcher);        return E_OUTOFMEMORY;    }    if(SCDynamicStoreSetNotificationKeys(g_store, watchingArrayRef, NULL))        CFRunLoopAddSource(CFRunLoopGetCurrent(), g_DnsWatcher, kCFRunLoopCommonModes);    CFRelease(watchingArrayRef);    RTSemEventSignal(g_DnsInitEvent);    CFRunLoopRun();    CFRelease(g_RunLoopRef);    return VINF_SUCCESS;}
开发者ID:etiago,项目名称:vbox,代码行数:31,


示例3: threadrun

void* threadrun(void* context){    // Tell the device manager which devices we want to look for    CFMutableArrayRef devices = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);    if(devices){        int vendor = V_CORSAIR;        int products[] = { P_K65, P_K70, P_K70_NRGB, P_K95, P_K95_NRGB };        for(uint i = 0; i < sizeof(products) / sizeof(int); i++){            int product = products[i];            CFMutableDictionaryRef device = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);            if(device){                CFDictionarySetValue(device, CFSTR(kIOHIDVendorIDKey), CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &vendor));                CFDictionarySetValue(device, CFSTR(kIOHIDProductIDKey), CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &product));                CFArrayAppendValue(devices, device);                CFRelease(device);            }        }        IOHIDManagerSetDeviceMatchingMultiple(usbmanager, devices);        CFRelease(devices);    }    // Set up device add callback    IOHIDManagerRegisterDeviceMatchingCallback(usbmanager, usbadd, 0);    IOHIDManagerScheduleWithRunLoop(usbmanager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);    IOHIDManagerOpen(usbmanager, kIOHIDOptionsTypeSeizeDevice);    // Make a new thread to handle key repeats. The OS won't do it for us.    pthread_create(&keyrepeatthread, 0, krthread, 0);    // Run the event loop. Existing devices will be detected automatically.    while(1){        CFRunLoopRun();    }    return 0;}
开发者ID:jsnel,项目名称:ckb,代码行数:34,


示例4: RunLoopThread

void* RunLoopThread(void* args){    unsigned i;    InitUSB();    currentRunLoop = CFRunLoopGetCurrent();    CFRunLoopTimerContext context = {0, NULL, NULL, NULL, NULL};    CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, 0.1, 0.1, 0, 0, &onTimerFired, &context);    CFRunLoopAddTimer(currentRunLoop, timer, kCFRunLoopCommonModes);    // Signal the parent that we are running    adb_mutex_lock(&start_lock);    adb_cond_signal(&start_cond);    adb_mutex_unlock(&start_lock);    CFRunLoopRun();    currentRunLoop = 0;    for (i = 0; i < vendorIdCount; i++) {        IOObjectRelease(notificationIterators[i]);    }    IONotificationPortDestroy(notificationPort);    usb_cleanup();    DBG("RunLoopThread done/n");    return NULL;    }
开发者ID:Ugryumych,项目名称:r2d2b2g,代码行数:30,


示例5: runServer

static void runServer(){    IOHIDEventSystemRef eventSystem = IOHIDEventSystemCreate(kCFAllocatorDefault);    IOHIDNotificationRef notification = NULL;        require(eventSystem, exit);            IOHIDEventSystemOpen(eventSystem, eventCallback, NULL, NULL, 0);                if ( !__serviceNotifications )        __serviceNotifications = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFArrayRef services = IOHIDEventSystemCopyMatchingServices(eventSystem, NULL, servicesAddedCallback, NULL, NULL, &notification);    if ( services ) {        servicesAddedCallback(NULL, NULL, NULL, services);        CFRelease(services);            }    CFRunLoopRun();exit:    if ( eventSystem )        CFRelease(eventSystem);}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:25,


示例6: main

int main(int argc, char **argv){    if(CheckArguments(argc, argv))        return 0;    KwmInit();    KWMMach.EventMask = ((1 << kCGEventKeyDown) |                         (1 << kCGEventKeyUp) |                         (1 << kCGEventMouseMoved));    KWMMach.EventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, KWMMach.EventMask, CGEventCallback, NULL);    if(!KWMMach.EventTap || !CGEventTapIsEnabled(KWMMach.EventTap))        Fatal("ERROR: Could not create event-tap!");    CFRunLoopAddSource(CFRunLoopGetMain(),                       CFMachPortCreateRunLoopSource(kCFAllocatorDefault, KWMMach.EventTap, 0),                       kCFRunLoopCommonModes);    CGEventTapEnable(KWMMach.EventTap, true);    CreateWorkspaceWatcher(KWMMach.WorkspaceWatcher);    // NOTE(koekeishiya): Initialize AXLIB    // AXLibInit(&AXApplications);    // AXLibRunningApplications();    NSApplicationLoad();    CFRunLoopRun();    return 0;}
开发者ID:alessandrostone,项目名称:kwm,代码行数:29,


示例7: main

int main(int argc, char *argv[]) {    if (argc < 2 || argc > 4) {        printf("usage: %s [-d] <app> [device_id]/n", argv[0]);        exit(1);    }        if (strcmp(argv[1], "-d") == 0) {        assert(argc == 3 || argc == 4);        debug = true;        app_path = argv[2];        if (argc == 4) {            device_id = argv[3];        }        printf("------ Install phase ------/n");    } else {        assert(argc == 2 || argc == 3);        app_path = argv[1];        if (argc == 3) {            device_id = argv[2];        }    }    assert(access(app_path, F_OK) == 0);    AMDSetLogLevel(5); // otherwise syslog gets flooded with crap    printf("[....] Waiting for iOS device to be connected/n");    struct am_device_notification *notify;    AMDeviceNotificationSubscribe(&device_callback, 0, 0, NULL, &notify);     CFRunLoopRun();}
开发者ID:MaksimKovalyov,项目名称:fruitstrap,代码行数:32,


示例8: 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,


示例9: main

int main(int argc, char* argv[]) {  if (argc != 2) {    fprintf(stderr, "usage: %s <directory-to-watch>/n", argv[0]);    exit(1);  }  CFStringRef path = CFStringCreateWithCString(    kCFAllocatorDefault,    argv[1],    kCFStringEncodingUTF8  );  CFArrayRef pathsToWatch = CFArrayCreate(    kCFAllocatorDefault,    (const void **)&path,    1,    NULL  );  // create stream  FSEventStreamRef stream = FSEventStreamCreate(    kCFAllocatorDefault,    _eventStreamCallback,    NULL, // context for callback    pathsToWatch,    kFSEventStreamEventIdSinceNow,    0, // latency    kFSEventStreamCreateFlagFileEvents // this flag was introduced in 10.7  );  FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);  FSEventStreamStart(stream);  CFRunLoopRun();  return EXIT_SUCCESS; // CFRunLoopRun never returns, we never get here}
开发者ID:carlwoodward,项目名称:bentoncrossfit,代码行数:35,


示例10: main

int main(int argc, const char *argv[]) {    // Create an event tap to retrieve keypresses.    CGEventMask eventMask = (CGEventMaskBit(kCGEventKeyDown) | CGEventMaskBit(kCGEventFlagsChanged));    CFMachPortRef eventTap = CGEventTapCreate(        kCGSessionEventTap, kCGHeadInsertEventTap, 0, eventMask, CGEventCallback, NULL    );    // Exit the program if unable to create the event tap.    if(!eventTap) {        fprintf(stderr, "ERROR: Unable to create event tap./n");        exit(1);    }    // Create a run loop source and add enable the event tap.    CFRunLoopSourceRef runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0);    CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);    CGEventTapEnable(eventTap, true);        initscr();    int row, col;    getmaxyx(stdscr,row,col);    clear();    mvprintw(row/2,(col-10)/2,"0.000000%%");       refresh();    CFRunLoopRun();    return 0;}
开发者ID:erd0s,项目名称:shit-typing-counter,代码行数:29,


示例11: main

int main (int argc, const char * argv[]){	SCNetworkReachabilityRef r = SCNetworkReachabilityCreateWithName(NULL, "api.del.icio.us");		if(r == NULL)	{		printf("Error creating reachability reference./n");		goto bail;	}		if(!SCNetworkReachabilitySetCallback(r, my_SCNetworkReachabilityCallBack, NULL))	{		printf("Unable to set reachability callback/n");		goto bail;	}		if(!SCNetworkReachabilityScheduleWithRunLoop(r, CFRunLoopGetCurrent(), kCFRunLoopCommonModes))	{		printf("Unable to schedule run loop monitoring on run loop./n");		goto bail;	}		printf("Starting run loop. Enable and disable network interfaces to fire the callback./n");	CFRunLoopRun();	printf("Run loop stopped/n");		bail:	if(r)		CFRelease(r);	    return 0;}
开发者ID:CarlChenCC,项目名称:examples,代码行数:33,


示例12: main

int main (int argc, const char * argv[]) {	// Show help	if (argc != 2 || strncmp(argv[1], "-h", 2) == 0) {		printf("Sleep until a file in or below the watchdir is modified./n");		printf("Usage: fsevent_watch /path/to/watchdir/n");		exit(1);	}	// Create event stream  CFStringRef pathToWatch = CFStringCreateWithCString(kCFAllocatorDefault, argv[1], kCFStringEncodingUTF8);  CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **)&pathToWatch, 1, NULL);  void *callbackInfo = NULL;  FSEventStreamRef stream;  CFAbsoluteTime latency = 0.5;  stream = FSEventStreamCreate(               kCFAllocatorDefault,               callback,               callbackInfo,               pathsToWatch,               kFSEventStreamEventIdSinceNow,               latency,               kFSEventStreamCreateFlagNone  );	// Add stream to run loop  FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);	FSEventStreamStart(stream);	CFRunLoopRun();	// Exit	return 2;}
开发者ID:seanmoon,项目名称:fresher.js,代码行数:32,


示例13: main

int main(void) {   // Prepare MIDI Interface Client/Port for writing MIDI data:   MIDIClientRef midiclient;   MIDIPortRef   midiin;   OSStatus status;   if (status = MIDIClientCreate(CFSTR("TeStInG"), NULL, NULL, &midiclient)) {      printf("Error trying to create MIDI Client structure: %d/n", status);      printf("%s/n", GetMacOSStatusErrorString(status));      exit(status);   }   if (status = MIDIInputPortCreate(midiclient, CFSTR("InPuT"), myReadProc,          NULL, &midiin)) {      printf("Error trying to create MIDI output port: %d/n", status);      printf("%s/n", GetMacOSStatusErrorString(status));      exit(status);   }   ItemCount nSrcs = MIDIGetNumberOfSources();   ItemCount iSrc;   for (iSrc=0; iSrc<nSrcs; iSrc++) {      MIDIEndpointRef src = MIDIGetSource(iSrc);      MIDIPortConnectSource(midiin, src, NULL);   }   t = lo_address_new(NULL, "7777");   CFRunLoopRef runLoop;   runLoop = CFRunLoopGetCurrent();   CFRunLoopRun();   return 0;}
开发者ID:dpiponi,项目名称:Moodler,代码行数:32,


示例14: main

int main(int argc, char** argv){    //    // From https://developer.apple.com/library/mac/qa/qa1340/_index.html    // I have basically no idea how this works :)    //    // notification port allocated by IORegisterForSystemPower    IONotificationPortRef  notifyPortRef;    // notifier object, used to deregister later    io_object_t            notifierObject;    // this parameter is passed to the callback    void*                  refCon;    // register to receive system sleep notifications    root_port = IORegisterForSystemPower(refCon, &notifyPortRef, SleepCallBack, &notifierObject);    if (root_port == 0) {        printf("IORegisterForSystemPower failed/n");        return 1;    }    // add the notification port to the application runloop    CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notifyPortRef), kCFRunLoopCommonModes);    /* Start the run loop to receive sleep notifications. Don't call CFRunLoopRun if this code        is running on the main thread of a Cocoa or Carbon application. Cocoa and Carbon        manage the main thread's run loop for you as part of their event handling        mechanisms.    */    CFRunLoopRun();    //Not reached, CFRunLoopRun doesn't return in this case.    return 0;}
开发者ID:saelo,项目名称:weesleep,代码行数:35,


示例15: btstack_thread_func

static void btstack_thread_func(void* data){   RARCH_LOG("[BTstack]: Thread started");   if (bt_open_ptr())      return;#ifdef __APPLE__   CFRunLoopSourceContext ctx = { 0, 0, 0, 0, 0, 0, 0, 0, 0, btstack_thread_stop };   btstack_quit_source = CFRunLoopSourceCreate(0, 0, &ctx);   CFRunLoopAddSource(CFRunLoopGetCurrent(), btstack_quit_source, kCFRunLoopCommonModes);#endif   RARCH_LOG("[BTstack]: Turning on.../n");   bt_send_cmd_ptr(btstack_set_power_mode_ptr, HCI_POWER_ON);   RARCH_LOG("BTstack: Thread running.../n");#ifdef __APPLE__   CFRunLoopRun();#endif   RARCH_LOG("[BTstack]: Thread done./n");#ifdef __APPLE__   CFRunLoopSourceInvalidate(btstack_quit_source);   CFRelease(btstack_quit_source);#endif}
开发者ID:matthijsberk,项目名称:RetroArch,代码行数:28,


示例16: play

void play() {    int i;    AudioStreamBasicDescription format;    AudioQueueRef queue;    AudioQueueBufferRef buffers[NUM_BUFFERS];    format.mSampleRate       = SAMPLE_RATE;    format.mFormatID         = kAudioFormatLinearPCM;    format.mFormatFlags      = kLinearPCMFormatFlagIsSignedInteger |                               kAudioFormatFlagIsPacked;    format.mBitsPerChannel   = 8*sizeof(SAMPLE_TYPE);    format.mChannelsPerFrame = NUM_CHANNELS;    format.mBytesPerFrame    = sizeof(SAMPLE_TYPE)*NUM_CHANNELS;    format.mFramesPerPacket  = 1;    format.mBytesPerPacket   = format.mBytesPerFrame*format.mFramesPerPacket;    format.mReserved         = 0;        AudioQueueNewOutput(&format, callback, NULL, CFRunLoopGetCurrent(),                        kCFRunLoopCommonModes, 0, &queue);        for (i = 0; i < NUM_BUFFERS; i++) {        AudioQueueAllocateBuffer(queue, BUFFER_SIZE, &buffers[i]);        buffers[i]->mAudioDataByteSize = BUFFER_SIZE;        callback(NULL, queue, buffers[i]);    }    AudioQueueStart(queue, NULL);    CFRunLoopRun();    }
开发者ID:chreekat,项目名称:Moodler,代码行数:29,


示例17: main

//set up fsevents and callbackint main(int argc, char **argv) {  if(argc != 3) {    fprintf(stderr, "You must specify a directory to watch and a command to execute on change/n");    exit(1);  }  to_run = argv[2];  CFStringRef mypath = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingUTF8);   CFArrayRef pathsToWatch = CFStringCreateArrayBySeparatingStrings (NULL, mypath, CFSTR(":"));  void *callbackInfo = NULL;   FSEventStreamRef stream;   CFAbsoluteTime latency = 1.0;  stream = FSEventStreamCreate(NULL,    &callback,    callbackInfo,    pathsToWatch,    kFSEventStreamEventIdSinceNow,    latency,    kFSEventStreamCreateFlagNone  );   FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);   FSEventStreamStart(stream);  CFRunLoopRun();}
开发者ID:bclennox,项目名称:fswatch,代码行数:31,


示例18: main

int main(int argc, char *argv[]) {	if (argc > 1) {		struct stat st;		if (stat(dirname(argv[1]), &st)==-1 && errno==ENOENT) {			fprintf(stderr, "Directory for writing does not exist./n");			exit(1);		}				realpath(argv[1], outputfile);		gen_path = 1;	}	else {		is_cwd = 1;		getcwd(outputfile, PATH_MAX);	}		am_device_notification *notification;	assert(AMDeviceNotificationSubscribe(device_notification_callback, 0, 0, NULL, &notification) == MDERR_OK);	puts("Waiting for device.");		signal(SIGINT, &sigint_handler);		CFRunLoopRun();		puts("Ending.");	return 0;}
开发者ID:theiostream,项目名称:bozocache,代码行数:27,


示例19: CFRunLoopGetCurrent

int HostDnsServiceDarwin::monitorWorker(){    m->m_RunLoopRef = CFRunLoopGetCurrent();    AssertReturn(m->m_RunLoopRef, VERR_INTERNAL_ERROR);    CFRetain(m->m_RunLoopRef);    CFArrayRef watchingArrayRef = CFArrayCreate(NULL,                                                (const void **)&kStateNetworkGlobalDNSKey,                                                1, &kCFTypeArrayCallBacks);    if (!watchingArrayRef)    {        CFRelease(m->m_DnsWatcher);        return E_OUTOFMEMORY;    }    if(SCDynamicStoreSetNotificationKeys(m->m_store, watchingArrayRef, NULL))        CFRunLoopAddSource(CFRunLoopGetCurrent(), m->m_DnsWatcher, kCFRunLoopCommonModes);    CFRelease(watchingArrayRef);    monitorThreadInitializationDone();    while (!m->m_fStop)    {        CFRunLoopRun();    }    CFRelease(m->m_RunLoopRef);    /* We're notifying stopper thread. */    RTSemEventSignal(m->m_evtStop);    return VINF_SUCCESS;}
开发者ID:mcenirm,项目名称:vbox,代码行数:35,


示例20: restart

Status EventTappingEventPublisher::run() {  Status s = restart();  if (s.ok()) {    CFRunLoopRun();  }  return s;}
开发者ID:theopolis,项目名称:osquery,代码行数:7,


示例21: cbWork

static void cbWork(uv_work_t *req) {	// We have this check in case we `Stop` before this thread starts,	// otherwise the process will hang	if(!isRunning) {		return;	}	uv_signal_start(&int_signal, cbTerminate, SIGINT);	uv_signal_start(&term_signal, cbTerminate, SIGTERM);	runLoopSource = IONotificationPortGetRunLoopSource(gNotifyPort);	gRunLoop = CFRunLoopGetCurrent();	CFRunLoopAddSource(gRunLoop, runLoopSource, kCFRunLoopDefaultMode);	// Creating `gRunLoop` can take some cycles so we also need this second	// `isRunning` check here because it happens at a future time	if(isRunning) {		// Start the run loop. Now we'll receive notifications.		CFRunLoopRun();	}	// The `CFRunLoopRun` is a blocking call so we also need this second	// `isRunning` check here because it happens at a future time	if(isRunning) {		// We should never get here while running		fprintf(stderr, "Unexpectedly back from CFRunLoopRun()!/n");	}}
开发者ID:apla,项目名称:node-usb-detection,代码行数:29,


示例22: druBurn

/*	druBurn		Called to do a burn.  Burning is a long async process, so this function mostly	handles providing appropriate progress and completion information to the user.*/intdruBurn(DRBurnRef burn, CFTypeRef layout){	DRNotificationCenterRef		notificationCenter = NULL;	CFRunLoopSourceRef			source = NULL;	druBurnStatus				status = {0, NULL, NULL, NULL, {0}, 0};		/* Create a progress bar. */	status.progressBar = druProgressBarCreate();		/* Sign up for notifications from the burn object. */	notificationCenter = DRNotificationCenterCreate();	source = DRNotificationCenterCreateRunLoopSource(notificationCenter);	CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes);	DRNotificationCenterAddObserver(notificationCenter,&status,druProgressCallback, kDRBurnStatusChangedNotification, burn);		/* Okay, kick off the burn. */	DRBurnWriteLayout(burn, layout);		/* Enter a runloop until the burn finishes. */	CFRunLoopRun();		/* Clean up memory and exit. */	CFRunLoopSourceInvalidate(source);	if (notificationCenter != NULL)	CFRelease(notificationCenter);	if (source != NULL)				CFRelease(source);	if (status.progressBar != NULL)	druProgressBarDispose(status.progressBar,status.success);	if (status.success)		printf("Burn completed./n");	else		druPrintFailureMessage("Burn", status.completionStatus);	if (status.completionStatus != NULL)	CFRelease(status.completionStatus);		return status.success;}
开发者ID:fruitsamples,项目名称:audioburntest,代码行数:41,


示例23: main

int main() {	initscr();	start_color();	use_default_colors();	init_pair(1, COLOR_RED, -1);	IOHIDManagerRef hidManager = IOHIDManagerCreate(		kCFAllocatorDefault, kIOHIDOptionsTypeNone);	IOHIDManagerRegisterDeviceMatchingCallback(		hidManager, match_callback, NULL);	IOHIDManagerScheduleWithRunLoop(		hidManager, CFRunLoopGetMain(), kCFRunLoopCommonModes);	// all keyboards	CFDictionaryRef match = matching_dictionary_create(0, 0, 1, 6);	// kinesis	/* CFDictionaryRef match = matching_dictionary_create(0x05f3, 0x0007, 0, 0); */	// noppoo	/* CFDictionaryRef match = matching_dictionary_create(0x1006, 0x0022, 1, 6); */	// a4tech	/* CFDictionaryRef match = matching_dictionary_create(0x1241, 0x1603, 0, 0); */	IOHIDManagerSetDeviceMatching(hidManager, match);	CFRelease(match);	CFRunLoopRun();}
开发者ID:GodJobs,项目名称:iousbhiddriver-descriptor-override,代码行数:33,


示例24: startListen

void startListen(){    CFMachPortRef	  eventTap;    CGEventMask		eventMask;    CFRunLoopSourceRef runLoopSource;        // Create an event tap. We are interested in key presses.    //eventMask = ((1 << kCGEventKeyDown) | (1 << kCGEventKeyUp) | (1 << kCGEventFlagsChanged));    eventMask = ((1 << kCGEventKeyDown) | (1 << kCGEventFlagsChanged));    eventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, 0,                                eventMask, myCGEventCallback, NULL);    if (!eventTap) {        fprintf(stderr, "failed to create event tap/n");        exit(1);    }        // Create a run loop source.    runLoopSource = CFMachPortCreateRunLoopSource(                                                  kCFAllocatorDefault, eventTap, 0);    // Add to the current run loop.    CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource,                       kCFRunLoopCommonModes);        // Enable the event tap.    CGEventTapEnable(eventTap, true);        // Set it all running.    CFRunLoopRun();        // In a real program, one would have arranged for cleaning up.}
开发者ID:ThaddyBear,项目名称:csgoGlow,代码行数:30,


示例25: DoListen

static void DoListen(ConnectionRef conn)    // Implements the "listen" command.  First this does a listen RPC     // to tell the server that this connection is now a listener.  Next it     // calls ConnectionRegisterListener to register a packet listener callback     // (GotPacket, above) on the runloop.  It then runs the runloop until its     // stopped (by a SIGINT, via SIGINTRunLoopCallback, below).{    int             err;    PacketListen    request;    PacketReply     reply;        InitPacketHeader(&request.fHeader, kPacketTypeListen, sizeof(request), true);        err = ConnectionRPC(conn, &request.fHeader, &reply.fHeader, sizeof(reply));    if (err == 0) {        err = reply.fErr;    }    if (err == 0) {        err = ConnectionRegisterListener(            conn,             CFRunLoopGetCurrent(),             kCFRunLoopDefaultMode,             GotPacket,             CFRunLoopGetCurrent()        );    }    if (err != 0) {        PrintResult("listen", err, NULL);    } else {        fprintf(stderr, "%*s Press ^C to quit./n", kResultColumnWidth, "listen");        CFRunLoopRun();    }}
开发者ID:dark-saber,项目名称:public,代码行数:34,


示例26: btstack_thread_func

static void* btstack_thread_func(void* data){   RARCH_LOG("BTstack: Thread started");   if (bt_open_ptr())   {      RARCH_LOG("BTstack: bt_open() failed/n");      return 0;   }   CFRunLoopSourceContext ctx = { 0, 0, 0, 0, 0, 0, 0, 0, 0, btstack_thread_stop };   btstack_quit_source = CFRunLoopSourceCreate(0, 0, &ctx);   CFRunLoopAddSource(CFRunLoopGetCurrent(), btstack_quit_source, kCFRunLoopCommonModes);   RARCH_LOG("BTstack: Turning on/n");   bt_send_cmd_ptr(btstack_set_power_mode_ptr, HCI_POWER_ON);   RARCH_LOG("BTstack: Running/n");   CFRunLoopRun();      RARCH_LOG("BTstack: Done/n");   CFRunLoopSourceInvalidate(btstack_quit_source);   CFRelease(btstack_quit_source);   return 0;}
开发者ID:Mbcpro,项目名称:RetroArch,代码行数:26,


示例27: main

int main (int argc, const char **argv) {		int ret;	makeRealtime();	ret = pulseAudioClientStart();	if (ret) {		printf("pulseAudioClientStart() returned %d/n", ret);		return -1;	}	ret = driverClientStart();	if (ret) {		printf("driverClientStart() returned %d/n", ret);		return -1;	}	ret = notificationCenterStart();	if (ret) {		printf("deviceClientStart() returned %d/n", ret);		return -1;	}	CFRunLoopRun();	printf("%s(): terminating .../n", __func__);	pulseAudioClientStop();		return 0;}
开发者ID:Cyclic,项目名称:PulseAudioOSX,代码行数:32,


示例28: main

int main( int argc, char* argv[] ){    /* Define variables and create a CFArray object containing CFString objects containing paths to watch. */    CFStringRef mypath      = CFStringCreateWithCString( NULL, argv[ 1 ], kCFStringEncodingUTF8);    CFArrayRef pathsToWatch = CFArrayCreate( NULL, ( const void ** ) &mypath, 1, NULL );    void *callbackInfo      = NULL; // could put stream-specific data here. FSEventStreamRef stream;*/    CFAbsoluteTime latency  = 3.0; /* Latency in seconds */    FSEventStreamRef stream;    /* Create the stream, passing in a callback */    stream = FSEventStreamCreate(        NULL,        &myCallbackFunction,        callbackInfo,        pathsToWatch,        kFSEventStreamEventIdSinceNow, /* Or a previous event ID */        latency,        kFSEventStreamCreateFlagFileEvents /* Flags explained in reference: https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/Reference/reference.html */    );    /* Create the stream before calling this. */    FSEventStreamScheduleWithRunLoop( stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode );    FSEventStreamStart( stream );    CFRunLoopRun();    return 0;}
开发者ID:javiergarmon,项目名称:OS-X-FSEvents,代码行数:30,


示例29: Stop

bool wxOSXAudioToolboxSoundData::Play(unsigned flags){    Stop();    m_flags = flags;    wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(m_sndname)));    CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);    wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false));    AudioServicesCreateSystemSoundID(url, &m_soundID);    AudioServicesAddSystemSoundCompletion( m_soundID, CFRunLoopGetCurrent(), NULL, wxOSXAudioToolboxSoundData::CompletionCallback, (void *) this );    bool sync = !(flags & wxSOUND_ASYNC);    AudioServicesPlaySystemSound(m_soundID);    if ( sync )    {        while( m_soundID )        {            CFRunLoopRun();        }    }    return true;}
开发者ID:NullNoname,项目名称:dolphin,代码行数:27,



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


C++ CFRunLoopRunInMode函数代码示例
C++ CFRunLoopRemoveSource函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。