On Wednesday 05 December 2012 16:39:47 Leif Walsh wrote:
> The important synchronization point isn't the rdunlock, it's the wrlock. 

Well, you need two locks, for a happens-before relationship to be established.
If you remove the rdlock/rdunlock completely (since it could basically be a 
no-op for a write operation anyway, as others pointed out earlier), then this 
will be more clear: this write might never become visible to the other thread.

> I have a hard time believing that you can take a pthread write lock and then
> look at a value some other processor wrote before you took the lock and not
> get that value.

You say "before", but this assumes a global ordering, which you don't get, 
when not using atomics or the proper locks.
Each CPU can have a different notion of "before", without the correct 
synchronization primitives.

I recommend reading "C++ Concurrency in action" by Anthony Williams, it taught 
me a lot on all this all works... definitely not a simple topic.

-- 
David Faure, [email protected], http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to