本文整理汇总了C++中IONotificationPortGetRunLoopSource函数的典型用法代码示例。如果您正苦于以下问题:C++ IONotificationPortGetRunLoopSource函数的具体用法?C++ IONotificationPortGetRunLoopSource怎么用?C++ IONotificationPortGetRunLoopSource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IONotificationPortGetRunLoopSource函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IOMasterPort
int AoEProperties::configure_matching(void)
{
// debugVerbose("AoEProperties::configure_matching\n");
// Obtain ports for notifications (this will be used for all service matching notifications)
kern_return_t kresult;
mach_port_t MasterPort;
kresult = IOMasterPort(MACH_PORT_NULL, &MasterPort);
if ( kresult )
{
debugError("Could not get masterport. Error=%d\n", kresult);
return false;
}
ms_NotificationPort = IONotificationPortCreate(MasterPort);
ms_IOKitNotificationRunLoopSource = IONotificationPortGetRunLoopSource(ms_NotificationPort);
CFRunLoopAddSource(CFRunLoopGetCurrent(), ms_IOKitNotificationRunLoopSource, kCFRunLoopDefaultMode);
// SetUp Notification for matching to our device
CFMutableDictionaryRef MatchingDict = IOServiceMatching(AOE_KEXT_NAME_Q);
IOServiceAddMatchingNotification(ms_NotificationPort,
kIOMatchedNotification,
MatchingDict,
AoEProperties::matched_callback,
this,
&ms_MatchIt);
// Call the callback immediately to check if our iterator already contains our device (ie. the device is already loaded)
matched_callback(this, ms_MatchIt);
return m_fMatched ? 0 : -1;
}
开发者ID:ecashin,项目名称:aoe-osx,代码行数:34,代码来源:AoEProperties.cpp
示例2: usbmain
int usbmain(){
int vendor = V_CORSAIR;
int products[] = { P_K65, P_K70, P_K70_NRGB, P_K95, P_K95_NRGB/*, P_M65*/ };
// Tell IOService which type of devices we want (IOHIDDevices matching the supported vendor/products)
CFMutableDictionaryRef match = IOServiceMatching(kIOHIDDeviceKey);
CFNumberRef cfvendor = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &vendor);
CFDictionarySetValue(match, CFSTR(kIOHIDVendorIDKey), cfvendor);
CFRelease(cfvendor);
CFMutableArrayRef cfproducts = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
for(uint i = 0; i < sizeof(products) / sizeof(int); i++){
int product = products[i];
CFNumberRef cfproduct = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &product);
CFArrayAppendValue(cfproducts, cfproduct);
CFRelease(cfproduct);
}
CFDictionarySetValue(match, CFSTR(kIOHIDProductIDArrayKey), cfproducts);
CFRelease(cfproducts);
notify = IONotificationPortCreate(kIOMasterPortDefault);
CFRunLoopAddSource(mainloop = CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notify), kCFRunLoopDefaultMode);
io_iterator_t iterator;
IOReturn res = IOServiceAddMatchingNotification(notify, kIOMatchedNotification, match, iterate_devices, 0, &iterator);
if(res != kIOReturnSuccess){
ckb_fatal("Failed to list devices: %x\n", res);
return -1;
}
// Iterate existing devices
iterate_devices(0, iterator);
// Enter loop to scan/connect new devices
CFRunLoopRun();
return 0;
}
开发者ID:akosipc,项目名称:ckb,代码行数:32,代码来源:usb_mac.c
示例3: lock
void IOKitEventPublisher::stop() {
if (run_loop_ == nullptr) {
// If there is no run loop then the publisher thread has not started.
return;
}
// Stop the run loop.
WriteLock lock(mutex_);
CFRunLoopStop(run_loop_);
// Stop the run loop before operating on containers.
// Destroy the IOPort.
if (port_ != nullptr) {
auto source = IONotificationPortGetRunLoopSource(port_);
if (CFRunLoopContainsSource(run_loop_, source, kCFRunLoopDefaultMode)) {
CFRunLoopRemoveSource(run_loop_, source, kCFRunLoopDefaultMode);
}
// And destroy the port.
IONotificationPortDestroy(port_);
port_ = nullptr;
}
// Clear all devices and their notifications.
for (const auto& device : devices_) {
IOObjectRelease(device->notification);
}
devices_.clear();
}
开发者ID:PoppySeedPlehzr,项目名称:osquery,代码行数:28,代码来源:iokit.cpp
示例4: mac_sleep_stop
void mac_sleep_stop()
{
if (root_port)
{
// remove the sleep notification port from the application runloop
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(notifyPortRef),
kCFRunLoopCommonModes);
// deregister for system sleep notifications
IODeregisterForSystemPower(¬ifierObject);
// IORegisterForSystemPower implicitly opens the Root Power Domain IOService
// so we close it here
IOServiceClose(root_port);
// destroy the notification port allocated by IORegisterForSystemPower
IONotificationPortDestroy(notifyPortRef);
// reset object members
root_port = 0;
notifyPortRef = NULL;
notifierObject = 0;
}
}
开发者ID:akoshelnik,项目名称:openvpn3,代码行数:25,代码来源:macsleep.hpp
示例5: CFRunLoopRemoveSource
void CCocoaPowerSyscall::DeleteOSPowerCallBacks(void)
{
#if !defined(TARGET_DARWIN_IOS)
CCocoaAutoPool autopool;
// we no longer want sleep/wake notifications
// remove the sleep notification port from the application runloop
CFRunLoopRemoveSource( CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(m_notify_port), kCFRunLoopDefaultMode );
// deregister for system sleep notifications
IODeregisterForSystemPower(&m_notifier_object);
// IORegisterForSystemPower implicitly opens the Root Power Domain IOService
// so we close it here
IOServiceClose(m_root_port);
// destroy the notification port allocated by IORegisterForSystemPower
IONotificationPortDestroy(m_notify_port);
// we no longer want power source change notifications
if (m_HasBattery)
{
if (m_power_source)
{
CFRunLoopRemoveSource( CFRunLoopGetCurrent(), m_power_source, kCFRunLoopDefaultMode );
CFRelease(m_power_source);
}
}
#endif
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:27,代码来源:CocoaPowerSyscall.cpp
示例6: secdebug
void XNotificationPort::addInterestNotification(XReceiver &receiver, io_service_t service,
const io_name_t interestType)
{
io_iterator_t iterator;
mach_port_t pp = NotificationPort::port();
// MachPlusPlus::Port(pp).dump(0);
secdebug("iokit", "XNotificationPort::addInterest - type: %s [port: %p (0x%08X), service: 0x%08X]",
interestType, mPortRef, pp, service); // IOServiceMatched
#if 1
CFRunLoopSourceRef notificationRunLoopSource = IONotificationPortGetRunLoopSource(mPortRef);
CFRunLoopSourceRef classRunLoopSource = NotificationPort::source();
// IONotificationPortRef r_notify_port = IONotificationPortCreate(0);
kern_return_t kr = ::IOServiceAddInterestNotification(mPortRef, //,r_notify_port
service, interestType, ioDeviceNotification, &receiver, &iterator);
const char *msgstr = mach_error_string(kr);
const char *msgtyp = mach_error_type(kr);
if (msgstr && msgtyp)
secdebug("iokit", " msg: %s, typ: %s", msgstr, msgtyp);
// Error::check(kr);
// if(r_notify_port) IOObjectRelease((io_object_t)r_notify_port);
#else
Error::check(::IOServiceAddInterestNotification(mPortRef,
service, interestType, ioDeviceNotification, &receiver, &iterator));
#endif
}
开发者ID:12019,项目名称:SmartCardServices,代码行数:25,代码来源:xiodevices.cpp
示例7: PortsCleanup
/* Cleanup of the open ports */
void PortsCleanup()
{
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notifyPortRef), kCFRunLoopCommonModes); /* Remove the notification port from the runloop */
IODeregisterForSystemPower(¬ifierObject); /* Deregister from power notifications */
IOServiceClose(root_power_port); /* Close the Root Power Domain IOService port */
IONotificationPortDestroy(notifyPortRef); /* Destroy the notification port */
}
开发者ID:toshiya240,项目名称:DeepSleep,代码行数:8,代码来源:deepsleep.c
示例8: InitIOKit
static Boolean InitIOKit() {
Boolean success = TRUE;
write_log(LOG_NOTICE, "Creating IOKit notification port.");
ioKitNotificationPort = IONotificationPortCreate(kIOMasterPortDefault);
if(ioKitNotificationPort == NULL) {
write_log(LOG_ERR, "Couldn't create IOKit notification port!");
success = FALSE;
goto EXIT;
}
write_log(LOG_NOTICE, "Creating IOKit RunLoop source.");
ioRunLoopSource = IONotificationPortGetRunLoopSource(ioKitNotificationPort);
if(ioRunLoopSource == NULL) {
write_log(LOG_ERR, "Couldn't create IOKit RunLoop source!");
success = FALSE;
goto EXIT;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), ioRunLoopSource,
kCFRunLoopDefaultMode);
EXIT:
return success;
}
开发者ID:razzfazz,项目名称:iscroll2,代码行数:28,代码来源:iScroll2Daemon.c
示例9: 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,代码来源:detection_mac.cpp
示例10: 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, ¬ifyPortRef, SleepCallBack, ¬ifierObject);
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,代码来源:themagic.c
示例11: IORegisterForSystemPower
void CCocoaPowerSyscall::CreateOSPowerCallBacks(void)
{
#if !defined(TARGET_DARWIN_IOS)
CCocoaAutoPool autopool;
// we want sleep/wake notifications, register to receive system power notifications
m_root_port = IORegisterForSystemPower(this, &m_notify_port, OSPowerCallBack, &m_notifier_object);
if (m_root_port)
{
// add the notification port to the application runloop
CFRunLoopAddSource(CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(m_notify_port), kCFRunLoopDefaultMode);
}
else
{
CLog::Log(LOGERROR, "%s - IORegisterForSystemPower failed", __FUNCTION__);
}
// if we have a battery, we want power source change notifications (on AC, on Battery, etc)
if (m_HasBattery)
{
m_power_source = IOPSNotificationCreateRunLoopSource(OSPowerSourceCallBack, this);
if (m_power_source)
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_power_source, kCFRunLoopDefaultMode);
else
CLog::Log(LOGERROR, "%s - IOPSNotificationCreateRunLoopSource failed", __FUNCTION__);
}
#endif
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:28,代码来源:CocoaPowerSyscall.cpp
示例12: InitUSB
static int
InitUSB()
{
CFMutableDictionaryRef matchingDict;
CFRunLoopSourceRef runLoopSource;
SInt32 vendor, if_subclass, if_protocol;
unsigned i;
//* To set up asynchronous notifications, create a notification port and
//* add its run loop event source to the program's run loop
notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
runLoopSource = IONotificationPortGetRunLoopSource(notificationPort);
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
memset(notificationIterators, 0, sizeof(notificationIterators));
//* loop through all supported vendors
for (i = 0; i < vendorIdCount; i++) {
//* Create our matching dictionary to find the Android device's
//* adb interface
//* IOServiceAddMatchingNotification consumes the reference, so we do
//* not need to release this
matchingDict = IOServiceMatching(kIOUSBInterfaceClassName);
if (!matchingDict) {
DBG("ERR: Couldn't create USB matching dictionary.\n");
return -1;
}
//* Match based on vendor id, interface subclass and protocol
vendor = vendorIds[i];
if_subclass = ADB_SUBCLASS;
if_protocol = ADB_PROTOCOL;
CFDictionarySetValue(matchingDict, CFSTR(kUSBVendorID),
CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type, &vendor));
CFDictionarySetValue(matchingDict, CFSTR(kUSBInterfaceSubClass),
CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type, &if_subclass));
CFDictionarySetValue(matchingDict, CFSTR(kUSBInterfaceProtocol),
CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type, &if_protocol));
IOServiceAddMatchingNotification(
notificationPort,
kIOFirstMatchNotification,
matchingDict,
AndroidInterfaceAdded,
NULL,
¬ificationIterators[i]);
//* Iterate over set of matching interfaces to access already-present
//* devices and to arm the notification
AndroidInterfaceAdded(NULL, notificationIterators[i]);
}
return 0;
}
开发者ID:Ugryumych,项目名称:r2d2b2g,代码行数:57,代码来源:usb_osx.cpp
示例13: main
int
main(void)
{
CFMutableDictionaryRef match;
IONotificationPortRef notifyPort;
CFRunLoopSourceRef notificationRunLoopSource;
io_iterator_t notificationIn, notificationOut;
// Create a matching dictionary for all IOMedia objects.
if (!(match = IOServiceMatching("IOMedia"))) {
fprintf(stderr, "*** failed to create matching dictionary.\n");
exit(1);
}
// Create a notification object for receiving I/O Kit notifications.
notifyPort = IONotificationPortCreate(kIOMasterPortDefault);
// Get a CFRunLoopSource that we will use to listen for notifications.
notificationRunLoopSource = IONotificationPortGetRunLoopSource(notifyPort);
// Add the CFRunLoopSource to the default mode of our current run loop.
CFRunLoopAddSource(CFRunLoopGetCurrent(), notificationRunLoopSource,
kCFRunLoopDefaultMode);
// One reference of the matching dictionary will be consumed when we install
// a notification request. Since we need to install two such requests (one
// for ejectable media coming in and another for it going out), we need
// to increment the reference count on our matching dictionary.
CFRetain(match);
// Install notification request for matching objects coming in.
// Note that this will also look up already existing objects.
IOServiceAddMatchingNotification(
notifyPort, // notification port reference
kIOMatchedNotification, // notification type
match, // matching dictionary
matchingCallback, // this is called when notification fires
NULL, // reference constant
¬ificationIn); // iterator handle
// Install notification request for matching objects going out.
IOServiceAddMatchingNotification(
notifyPort,
kIOTerminatedNotification,
match,
matchingCallback,
NULL,
¬ificationOut);
// Invoke callbacks explicitly to empty the iterators/arm the notifications.
matchingCallback(0, notificationIn);
matchingCallback(0, notificationOut);
CFRunLoopRun(); // run
exit(0);
}
开发者ID:Leask,项目名称:Mac-OS-X-Internals,代码行数:57,代码来源:mediamon.c
示例14: iSCSIDDeregisterForPowerEvents
/*! Deregisters the daemon with the kernel to no longer receive power events. */
void iSCSIDDeregisterForPowerEvents()
{
CFRunLoopRemoveSource(CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(powerNotifyPortRef),
kCFRunLoopDefaultMode);
IODeregisterForSystemPower(&powerNotifier);
IOServiceClose(powerPlaneRoot);
IONotificationPortDestroy(powerNotifyPortRef);
}
开发者ID:bafomet,项目名称:iSCSIInitiator,代码行数:11,代码来源:iSCSIDaemon.c
示例15: InitUPSNotifications
void InitUPSNotifications()
{
CFMutableDictionaryRef matchingDict;
CFMutableDictionaryRef propertyDict;
kern_return_t kr;
// Create a notification port and add its run loop event source to our run loop
// This is how async notifications get set up.
//
gNotifyPort = IONotificationPortCreate(kIOMasterPortDefault);
CFRunLoopAddSource( CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(gNotifyPort),
kCFRunLoopDefaultMode);
// Create the IOKit notifications that we need
//
matchingDict = IOServiceMatching(kIOServiceClass);
if (!matchingDict)
return;
propertyDict = CFDictionaryCreateMutable(kCFAllocatorDefault,
0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
if (!propertyDict)
{
CFRelease(matchingDict);
return;
}
// We are only interested in devices that have kIOUPSDeviceKey property set
CFDictionarySetValue(propertyDict, CFSTR(kIOUPSDeviceKey), kCFBooleanTrue);
CFDictionarySetValue(matchingDict, CFSTR(kIOPropertyMatchKey), propertyDict);
CFRelease(propertyDict);
// Now set up a notification to be called when a device is first matched by I/O Kit.
// Note that this will not catch any devices that were already plugged in so we take
// care of those later.
kr = IOServiceAddMatchingNotification(gNotifyPort, // notifyPort
kIOFirstMatchNotification, // notificationType
matchingDict, // matching
UPSDeviceAdded, // callback
NULL, // refCon
&gAddedIter // notification
);
if ( kr != kIOReturnSuccess )
return;
UPSDeviceAdded( NULL, gAddedIter );
}
开发者ID:hashier,项目名称:caffeinate_fix,代码行数:54,代码来源:upsd.c
示例16: mac_sleep_start
bool mac_sleep_start()
{
if (!root_port)
{
root_port = IORegisterForSystemPower(this, ¬ifyPortRef, callback_static, ¬ifierObject);
if (!root_port)
return false;
CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notifyPortRef), kCFRunLoopCommonModes);
}
return true;
}
开发者ID:akoshelnik,项目名称:openvpn3,代码行数:11,代码来源:macsleep.hpp
示例17: IONotificationPortCreate
bool HIDDevice::setupDevicePluggedInNotification()
{
// Setup notification when devices are plugged in.
RepluggedNotificationPort = IONotificationPortCreate(kIOMasterPortDefault);
CFRunLoopSourceRef notificationRunLoopSource =
IONotificationPortGetRunLoopSource(RepluggedNotificationPort);
CFRunLoopAddSource(HIDManager->getRunLoop(),
notificationRunLoopSource,
kCFRunLoopDefaultMode);
CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOUSBDeviceClassName);
// Have to specify vendorId and productId. Doesn't seem to accept additional
// things like serial number.
SInt32 vendorId = DevDesc.VendorId;
CFNumberRef numberRef = CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type,
&vendorId);
CFDictionarySetValue(matchingDict, CFSTR(kUSBVendorID), numberRef);
CFRelease(numberRef);
SInt32 deviceProductId = DevDesc.ProductId;
numberRef = CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type,
&deviceProductId);
CFDictionarySetValue(matchingDict, CFSTR(kUSBProductID), numberRef);
CFRelease(numberRef);
kern_return_t result =
IOServiceAddMatchingNotification(RepluggedNotificationPort,
kIOMatchedNotification,
matchingDict,
staticDeviceAddedCallback,
this,
&RepluggedNotification);
if (result != KERN_SUCCESS)
{
CFRelease(RepluggedNotificationPort);
RepluggedNotificationPort = 0;
return false;
}
// Iterate through to arm.
while (IOIteratorNext(RepluggedNotification))
{
}
return true;
}
开发者ID:123woodman,项目名称:minko,代码行数:53,代码来源:OVR_OSX_HIDDevice.cpp
示例18: ASSERT
// m_LoopRef needs to be set before this is called
void InputHandler_MacOSX_HID::StartDevices()
{
int n = 0;
ASSERT( m_LoopRef );
FOREACH( HIDDevice *, m_vDevices, i )
(*i)->StartQueue( m_LoopRef, InputHandler_MacOSX_HID::QueueCallback, this, n++ );
CFRunLoopSourceRef runLoopSource = IONotificationPortGetRunLoopSource( m_NotifyPort );
CFRunLoopAddSource( m_LoopRef, runLoopSource, kCFRunLoopDefaultMode );
}
开发者ID:AratnitY,项目名称:stepmania,代码行数:13,代码来源:InputHandler_MacOSX_HID.cpp
示例19: CFRunLoopGetCurrent
void
COSXScreen::watchSystemPowerThread(void*)
{
io_object_t notifier;
IONotificationPortRef notificationPortRef;
CFRunLoopSourceRef runloopSourceRef = 0;
m_pmRunloop = CFRunLoopGetCurrent();
// install system power change callback
m_pmRootPort = IORegisterForSystemPower(this, ¬ificationPortRef,
powerChangeCallback, ¬ifier);
if (m_pmRootPort == 0) {
LOG((CLOG_WARN "IORegisterForSystemPower failed"));
}
else {
runloopSourceRef =
IONotificationPortGetRunLoopSource(notificationPortRef);
CFRunLoopAddSource(m_pmRunloop, runloopSourceRef,
kCFRunLoopCommonModes);
}
// thread is ready
{
CLock lock(m_pmMutex);
*m_pmThreadReady = true;
m_pmThreadReady->signal();
}
// if we were unable to initialize then exit. we must do this after
// setting m_pmThreadReady to true otherwise the parent thread will
// block waiting for it.
if (m_pmRootPort == 0) {
return;
}
// start the run loop
LOG((CLOG_DEBUG "started watchSystemPowerThread"));
CFRunLoopRun();
// cleanup
if (notificationPortRef) {
CFRunLoopRemoveSource(m_pmRunloop,
runloopSourceRef, kCFRunLoopDefaultMode);
CFRunLoopSourceInvalidate(runloopSourceRef);
CFRelease(runloopSourceRef);
}
CLock lock(m_pmMutex);
IODeregisterForSystemPower(¬ifier);
m_pmRootPort = 0;
LOG((CLOG_DEBUG "stopped watchSystemPowerThread"));
}
开发者ID:rakete,项目名称:synergy-foss,代码行数:52,代码来源:COSXScreen.cpp
示例20: main
int main( int argc, char **argv ) {
IONotificationPortRef notifyPortRef;
io_object_t notifierObject;
void* refCon;
root_port = IORegisterForSystemPower( refCon, ¬ifyPortRef, MySleepCallBack, ¬ifierObject );
if ( root_port == 0 ) {
printf("IORegisterForSystemPower failed\n");
return 1;
}
CFRunLoopAddSource( CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notifyPortRef), kCFRunLoopCommonModes );
CFRunLoopRun();
return (0);
}
开发者ID:QuinnEbert,项目名称:SaneWake,代码行数:13,代码来源:SaneWake.c
注:本文中的IONotificationPortGetRunLoopSource函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论