Re: [LAD] a *simple* ring buffer, comments pls?

From: Dan Muresan <danmbox@email-addr-hidden>
Date: Tue Jul 12 2011 - 15:44:23 EEST

> updating the read index, yes?  how is that expressed as portably as
> possible?  Does __sync_synchronized reliably do that?  (The
> documentation is surprisingly short...)

I wonder if

{
pthread_mutex_t dummy = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&dummy);
pthread_mutex_unlock(&dummy);
}

doesn't provide a portable full memory barrier. The dummy is different
each time, so no contention -- but still inefficient since this would
be a 2-step full barrier. Nevertheless, it could be a portable
fallback.

Oh, and you probably need a barrier in the consummer too, just
reasoning from symmetry.

-- Dan
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Tue Jul 12 16:15:02 2011

This archive was generated by hypermail 2.1.8 : Tue Jul 12 2011 - 16:15:02 EEST