site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Jun 9, 2006, at 5:02 AM, Shaun Wexler wrote: As Kevin said, please file bugs. This isn't your fault. #include <mach/mach_time.h> #include <servers/bootstrap.h> char *servicename[] = { "com.apple.CoreServices.coreservicesd", "com.apple.windowserver.active" }; Please, please file bugs. Thanks! :-) davez _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Both of these issues are reliably unreliable, in that they happen every 1 out of 5 reboots or so. Of course this won't work for services that are on-demand/inactive, but how about something like this (untested, written in Mail): 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(). This email sent to site_archiver@lists.apple.com