• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Very early load and usage of higher level APIs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


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>)

  • Prev by Date: Re: Very early load and usage of higher level APIs
  • Next by Date: Re: Question on using launchd from a C program
  • Previous by thread: Re: Very early load and usage of higher level APIs
  • Next by thread: kqueue - supported filesystems?
  • Index(es):
    • Date
    • Thread