How can my daemon detect that machine is restarted
How can my daemon detect that machine is restarted
- Subject: How can my daemon detect that machine is restarted
- From: Martin Bestmann <email@hidden>
- Date: Thu, 4 Aug 2005 23:58:46 +0200
Hi,
I need to find out if my daemon was launched after a restart or
during the normal install. Basically I need to now if a machine was
restarted.
I thought IORegisterForSystemPower would do this but I do not get the
kIOMessageSystemWillRestart message.
Here is my code that registers for the notification.
gRootPort=IORegisterForSystemPower
(0,¬ify,SystemPowerChangedCallback,&anIterator);
if (gRootPort) CFRunLoopAddSource(CFRunLoopGetCurrent
(),IONotificationPortGetRunLoopSource(notify),kCFRunLoopDefaultMode);
I do get kIOMessageCanSystemSleep when the system is put to sleep.
It could be that my daemon gets killed before I get the
kIOMessageSystemWillRestart message.
Is there a better way to find out if the machine is restarted?
Thanks,
Martin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden