Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very early load and usage of higher level APIs



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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >Very early load and usage of higher level APIs (From: Ryan McGann <email@hidden>)
 >Re: Very early load and usage of higher level APIs (From: Shaun Wexler <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.