pub unsafe extern "C-unwind" fn IOPSNotificationCreateRunLoopSource(
callback: IOPowerSourceCallbackType,
context: *mut c_void,
) -> Option<CFRetained<CFRunLoopSource>>ps only.Expand description
Returns a CFRunLoopSourceRef that notifies the caller when power source information changes.
Returns a CFRunLoopSourceRef for scheduling with your CFRunLoop.
If your project does not use a CFRunLoop, you can alternatively
receive notifications via mach port, dispatch, or signal, via
notify.h
using the name
kIOPSTimeRemainingNotificationKeyIOKit delivers this notification when percent remaining or time remaining changes.
Thus it fires fairly frequently while discharging or charging the battery;
please consider using:
IOPSCreateLimitedPowerNotificationParameter callback: A function to be called whenever any power source is added, removed, or changes.
Parameter context: Any user-defined pointer, passed to the IOPowerSource callback.
Returns: Returns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must release the CFRunLoopSource.
ยงSafety
callbackmust be implemented correctly.contextmust be a valid pointer.