Re: pthreads and standard C library calls and maybe magic Xcode switches
Re: pthreads and standard C library calls and maybe magic Xcode switches
- Subject: Re: pthreads and standard C library calls and maybe magic Xcode switches
- From: Cem Karan <email@hidden>
- Date: Wed, 22 Aug 2007 13:09:10 -0400
On Aug 22, 2007, at 12:45 PM, Alastair Houghton wrote:
[SNIP]
You can write "valid" pthreads programs, even with locking, that
won't work right. Hans Boehm wrote a paper about this problem:
<http://www.hpl.hp.com/techreports/2004/HPL-2004-209.html>
It's worth reading. Fortunately most modern compilers don't do the
transformations that make locking code work the wrong way, but---
unless you write "volatile"---they're perfectly at liberty to do so
according to the C standard.
Got it, and reading through it now. Thanks!
On Wed, 22 Aug 2007 07:37:05 -0400, Cem Karan wrote:
Are you saying that the locking constructs will ensure that the
cache
is always flushed back to main memory?
No. But they will enforce strong memory ordering at those
boundaries. That is, when you take a lock, it is guaranteed that
all writes prior to that lock (will *seem* to have) completed from
the perspective of other processors in the system.
And this is the important thing for my code; I don't care if the data
is actually flushed all the way out to RAM or not, I just want to
make sure that all threads on the system see the same data.
Thanks,
Cem Karan
_______________________________________________
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