On Mar 30, 2005, at 10:55 AM, George Warner wrote:
On Wed, 30 Mar 2005 01:01:29 -0800, John Stiles <email@hidden>
wrote:
Which reminds me of another thing I
noticed--MPEnter/ExitCriticalRegion
seemed to be a lot slower than the raw pthread solution, according to
Shark. Why is this? Seems like one should be just as good as the
other.
Having walked thru the MP critical region code on more than one
occasion I'd
say that it's not only overly paranoid about all the edge cases (as it
should be) it also has to handle re-entrancy and the duration timeout
cases
(and their edge cases) where POSIX doesn't.
If you don't care about re-entrancy then you can use MP semaphores
instead.
If you don't need the delay then a simple POSIX mutex is probably
better.
I recommend MP over POSIX for all but the most advanced thread
programmers.
It doesn't have POSIX's steep learning curve and is very powerful. But
if
you don't need all it's bells and whistles then the simplest POSIX
code can
certainly perform faster.
I was using kDurationForever, and I don't see why re-entrancy is any
different between MP and pthread APIs (I was using a recursive mutex).
So I still don't know if there is a good excuse here.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden