Re: Very early load and usage of higher level APIs
Re: Very early load and usage of higher level APIs
- Subject: Re: Very early load and usage of higher level APIs
- From: Dave Zarzycki <email@hidden>
- Date: Fri, 9 Jun 2006 10:19:05 -0700
On Jun 9, 2006, at 5:02 AM, Shaun Wexler wrote:
Both of these issues are reliably unreliable, in that they happen
every 1 out of 5 reboots or so.
As Kevin said, please file bugs. This isn't your fault.
Of course this won't work for services that are on-demand/inactive,
but how about something like this (untested, written in Mail):
#include <mach/mach_time.h>
#include <servers/bootstrap.h>
char *servicename[] = {
"com.apple.CoreServices.coreservicesd",
"com.apple.windowserver.active"
};
bootstrap_status_t serviceactive;
mach_timebase_info_data_t info;
(void)mach_timebase_info(&info);
uint64_t poll_interval = 1000000000ULL * info.denom / info.numer; //
1 second
uint32_t i = 0;
do {
while (bootstrap_status(bootstrap_port, servicename[i],
&serviceactive) == BOOTSTRAP_UNKNOWN_SERVICE && ! serviceactive) {
mach_wait_until(poll_interval + mach_absolute_time());
}
} while (++i < sizeof(servicename) / sizeof(servicename[0]));
For many different reasons, I would not recommend the above strategy.
If you must workaround OS bugs, I'd much rather advise putting a
blatant sleep(10) at the top of your main().
Please, please file bugs. Thanks! :-)
davez
_______________________________________________
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