• 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: pthreads and standard C library calls and maybe magic Xcode switches
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: pthreads and standard C library calls and maybe magic Xcode switches
      • From: Alastair Houghton <email@hidden>
References: 
 >Re: pthreads and standard C library calls and maybe magic Xcode switches (From: Cem Karan <email@hidden>)
 >Re: pthreads and standard C library calls and maybe magic Xcode switches (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: pthreads and standard C library calls and maybe magic Xcode switches
  • Next by Date: Re: pthreads and standard C library calls and maybe magic Xcode switches
  • Previous by thread: Re: pthreads and standard C library calls and maybe magic Xcode switches
  • Next by thread: Re: pthreads and standard C library calls and maybe magic Xcode switches
  • Index(es):
    • Date
    • Thread