Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Again ReadMemoryBarrier() etc
Re: Again ReadMemoryBarrier() etc [message #10436 is a reply to message #10434] Mon, 09 July 2007 11:07 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14261
Registered: November 2005
Ultimate Member
arturbac wrote on Mon, 09 July 2007 04:50

luzr wrote on Mon, 09 July 2007 09:49

Sorry, but

Fourth, the idea that "the _WriteBarrier function forces writes to memory to complete at the point of the call. After the call, other threads can access the memory without fear that the thread that made the call might have a pending write to the memory." is wrong as well, even if you would thing that it emits actual CPU write barrier. This is not what a write barrier does for you... (but your mistake is quite understandable, because I was under this false impression too a couple of months ago....)

Mirek


This is not my mistake this is from MSDN info about how this instristic work.

Who has right You or Microsoft ? Smile



Actually, Microsoft documentation is quite often wrong or misleading about MT issues...

Anyway, read more carefully into the link you posted:

Quote:


As part of its optimization algorithms, the Visual C++ compiler might reorder memory reads and writes in unpredictable ways between explicit accesses to a variable. As a result, the value of that variable might not have a predictable value between each explicit use of the variable. This could cause problems in multithreaded programming.



You can also look here:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=177456 1&SiteID=1

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MT assertion failed in IsST()
Next Topic: Non-Blocking socket example
Goto Forum:
  


Current Time: Mon Jun 16 12:54:20 CEST 2025

Total time taken to generate the page: 0.03613 seconds