Re: detecting Leopard from gcc
Re: detecting Leopard from gcc
- Subject: Re: detecting Leopard from gcc
- From: Ethan Tira-Thompson <email@hidden>
- Date: Sun, 11 Nov 2007 12:22:07 -0500
Condensing replies: (sorry Jens for repost, accidentally replied to
you individually instead of list)
Jens Miltner wrote:
You could use MAC_OS_X_VERSION_MAX_ALLOWED:
Ah, perfect, thanks! (Sorry, this was probably pretty obvious to you,
but I didn't know about AvailabilityMacros.h per se... just knew there
must be a "right" way ;)
Brad Oliver wrote:
If you mean as part of your build process, try /usr/bin/sw_vers. See
the man page for additional options.
I did also run into one or two things to tweak in my script-based
tools, but found 'uname -r' to work well (Tiger currently returns
8.10.1, Leopard 9.0.0). So although I could have the build do the
detection and set a flag, I was hoping there would be one already in
the system (i.e. AvailabilityMacros.h)
Jonas Maebe wrote:
As a side note: doesn't this mean that you also sporadically get
errors on Tiger in case the syscall just exited for some reason when
the signal arrives?
No, because I'll get the signal regardless of whether it was in a
syscall or somewhere in my own code... then the signal handler can
testcancel(), or if needed can go back to what it was doing. (I set a
flag for the handler to know if the code was in a critical section,
essentially reimplementing pthread_setcancel{state,type} with signals :
( )
The only problem is on the cancelling side if the thread somehow exits
between the sanity check that it's still running and the call to
pthread_kill() to send the signal... previously that was impossible
because the threads I use run until cancelled, so they don't exit on
their own. But now the cancel goes through, and the signal might be
sent to a dead thread. This is really only caues an error return by
the pthread_kill call though, which you could ignore, so it's not a
huge problem. (I used to always send the signal on all platforms,
until a problem cropped up in Fedora Core 5 (but not other distros
before that... *shrug*), so now this whole signalling mess is just
reserved for Tiger and prior.)
For anyone curious, my Thread wrapper is here: (C++, LGPL)
http://cvs.tekkotsu.org/viewvc/Tekkotsu/IPC/Thread.h?revision=HEAD&view=markup
http://cvs.tekkotsu.org/viewvc/Tekkotsu/IPC/Thread.cc?revision=HEAD&view=markup
... of note to this discussion is stop() (polite request to cancel),
interrupt() (send SIGALRM), and handleInterrupt()
thanks!
-ethan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden