• 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: Posix Timers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Posix Timers?


  • Subject: Re: Posix Timers?
  • From: Terry Lambert <email@hidden>
  • Date: Mon, 7 Jan 2008 15:07:50 -0800

On Jan 5, 2008, at 10:06 AM, Steve Checkoway wrote:
On Jan 5, 2008, at 8:53 AM, Andre-John Mas wrote:
Could someone tell me whether MacOS X supports POSIX timers?


If you mean the api specified in <http://www.jaluna.com/doc/c5/html/Overview/x5408.html > (just the first hit on google), then the answer would seem to be no:

$ find /usr/include -name '*.h'|xargs egrep 'clock_(settime|gettime| getres)|timer_(create|delete|settime|gettime|getoverrun)|nanosleep'
/usr/include/php/ext/standard/ basic_functions.h:PHP_FUNCTION(time_nanosleep);
/usr/include/php/main/php_config.h:/* Define if you have the nanosleep function. */
/usr/include/time.h:int nanosleep(const struct timespec *, struct timespec *) __DARWIN_ALIAS_C(nanosleep);


Only nanosleep seems to be there.

Specifically, all POSIX functionality should be feature tested using <unistd.h> macros before you assume it's there; for POSIX Timers:


% grep TIMER /usr/include/unistd.h
#define _POSIX_TIMERS                   (-1)            /* [TMR] */

So no.

The proper way to feature test POSIX interfaces is:

#include <unistd.h>
...
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS - 200112L) >= 0L
/* This POSIX feature is supported */
...
#else
/* This POSIX feature is not supported; use an alternate implementation */
...
#endif


-- Terry
_______________________________________________
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: 
 >Posix Timers? (From: Andre-John Mas <email@hidden>)
 >Re: Posix Timers? (From: Steve Checkoway <email@hidden>)

  • Prev by Date: Re: fread/fwrite/fflush bug
  • Next by Date: Re: pthread_cond_wait() missing broadcast?
  • Previous by thread: Re: Posix Timers?
  • Next by thread: Re: Posix Timers?
  • Index(es):
    • Date
    • Thread