Newsgroups: comp.programming.threads
From: Dave Butenhof <buten...@zko.dec.com>
Date: 1997/07/03
Subject: Re: C++, volatile member functions, and threads
I really should ignore this deepening rat-hole. But, OK, just one more Patrick TJ McPhee wrote: They exhibit the same essential flaw, the same misunderstanding of "what > Later, he introduced his non-thread-safe member function as an example it all means". This is of course no surprise, since the EXAMPLE was indeed an example of the CONCEPT. It was substantially easier, and more direct, to explain why the example wouldn't behave correctly than to work with the generic concept. But they're the same thing, and I don't see how you could consider comments on the example "irrelevant" to the concept it demonstrates. And as for "optimization"... if one is not interested in "optimizing", > So sure, let's all agree that we shouldn't assume certain operations The use of "volatile" is not sufficient to ensure proper memory > will be done in a single instruction and are therefore safe. Let's > assume that you have to provide for thread synchronisation if you're > going to update shared objects. Now what about the original question. > Why shouldn't these objects be considered volatile? visibility or synchronization between threads. The use of a mutex is sufficient, and, except by resorting to various non-portable machine code alternatives, (or more subtle implications of the POSIX memory rules that are much more difficult to apply generally, as explained in my previous post), a mutex is NECESSARY. Therefore, as Bryan explained, the use of volatile accomplishes nothing Because of this flaw in reasoning, Eric's EXAMPLE of his CONCEPT was I'd like to stop beating this to death. It's not fair to Eric, who /---------------------------[ Dave Butenhof ]--------------------------\ You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||