Re: Threading in new C++ standard
"Dmitriy V'jukov" <dvyukov@gmail.com> wrote in message
news:f4905e09-1344-4643-8033-5566409cfb76@25g2000hsx.googlegroups.com...
On 2 ???, 01:08, "Chris Thomasson" <cris...@comcast.net> wrote:
So you can't implement VZOOM object lifetime management in
autodetection mode, you need compiler_acquire_barrier and
compiler_release_barrier.
No way could I do highly platform dependant auto-detection with C++0x.
You
can get it to work with signals, but that's a little crazy:
I am saying not about auto-detection logic itself, but about
vz_acquire()/vz_release() functions. I think they look something like
this:
void vz_acquire(void* p)
{
per_thread_rc_array[hash(p)] += 1;
compiler_acquire_barrier(); // <--------------
}
void vz_release(void* p)
{
compiler_release_barrier(); // <--------------
per_thread_rc_array[hash(p)] -= 1;
}
The question: will you have to manually implement and port to every
compiler compiler_acquire_barrier()/compiler_release_barrier()?
The implementation of the function which mutates the array is externally
compiled:
http://groups.google.com/group/comp.lang.c/browse_frm/thread/1d0b291ee41a7fb5
and I document that link-time optimization level should be turned down, or
off... Oh well.