• 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
detecting Leopard from gcc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

detecting Leopard from gcc


  • Subject: detecting Leopard from gcc
  • From: Ethan Tira-Thompson <email@hidden>
  • Date: Sat, 10 Nov 2007 16:26:14 -0500

I've noticed there is improved handling of thread cancel points in 10.5/Leopard [*]. I would like to have my code be able to detect which system it is compiling under so it can fall back to using pthread_kill to send a signal under Tiger, but otherwise rely on the cancel point handling in Leopard.

So, how to detect Leopard? Ideally, through an #ifdef? I thought of using an __APPLE_CC__ version check, but decided that Apple might upgrade the compiler in Tiger as well (or already has, I didn't try Xcode 2.5). Is there a better way?

thanks
 -ethan

[*] My code is multithreaded, and it appears Leopard now (more fully) supports pthread_cancel(). (in Tiger, none of the system calls were actually enabled as cancel points, so the pthread_cancel was ignored until an explicit pthread_testcancel())

So in Tiger I was using pthread_kill to send a signal to break out of system calls (e.g. sleep(), read(), connect()...) so it can then make the call to pthread_testcancel, but now this is unnecessary (and often gives an error if the cancel goes through before the signal is sent)

If anyone has more details about which system calls are valid cancel points, I'd appreciate it since I haven't had time to test this... the man page for pthread_setcanceltype in Tiger already listed a variety of cancelation points that were valid in BSD, but not actually valid in Darwin, so I don't necessarily trust that all of the functions are now supported in Leopard...
_______________________________________________
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
  • Follow-Ups:
    • Re: detecting Leopard from gcc
      • From: Jonas Maebe <email@hidden>
  • Prev by Date: Re: troubleshooting unrecognised selector messages
  • Next by Date: Re: Bus error on Leopard with 64-bit program
  • Previous by thread: IO80211Interface/IO80211Controller finally (somewhat?) open
  • Next by thread: Re: detecting Leopard from gcc
  • Index(es):
    • Date
    • Thread