Re: mulithreading, dual-core
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