• 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: mulithreading, dual-core
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mulithreading, dual-core


  • Subject: Re: mulithreading, dual-core
  • From: John Daniel <email@hidden>
  • Date: Sun, 25 Feb 2007 09:28:59 -0600

Jordan,
For a command line C++ tool, you'll want to use pthreads, as someone else explained. The basic operation of pthreads is pretty simple and like most other similar implementations. There are a few very important points to know:


Don't bother with recursive mutexes. They have some fundamental paradoxes. You can avoid them with slightly more verbose code.

Be very careful with conditions. They work, but they are a bit of a hassle. There is no guarantee that when pthread_condition_wait returns, your condition is set. It has to be in a loop.

If you plan to really use C++, you can create a Guard class to make your mutex lock code much simpler and less verbose.

Finally, and most importantly with the dual-core Macs. Learn about the volatile modifier. Your code isn't going to be just multithreaded, it will be parallel. You won't be able to get away with just mutex locks. They will have to be volatile mutex locks.

Have fun!

John

On Feb 25, 2007, at 8:41 AM, email@hidden wrote:

I'm new to Xcode. I use the command line utility/C++ tool. Can I use it to write mulithreaded applications? Are there any examples? Are there examples for writing dual-core appliications in this environment?

I'm using an iMac running Tiger 10.4.

Thanks,
Jordon

_______________________________________________ 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: mulithreading, dual-core
      • From: Shawn Erickson <email@hidden>
References: 
 >mulithreading, dual-core (From: email@hidden)

  • Prev by Date: Re: Stderr in red
  • Next by Date: Re: mulithreading, dual-core
  • Previous by thread: Re: mulithreading, dual-core
  • Next by thread: Re: mulithreading, dual-core
  • Index(es):
    • Date
    • Thread