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

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

> from my understanding, sem_post() implies a write barrier (stores have been
> executed before sem_post()) and sem_wait() a read barrier (loads have to be
> executed after sem_wait()).

Given that a mutex can be replaced with a semaphore initialized with 1
(then lock == sem_wait, unlock == sem_post), your statement should be
true as long as the semaphore value is 0 / 1.

However, I don't know if your statement must still be true when the
semaphore is used as a count tied to a number of items, i.e. when it
always hovers above 1. POSIX talks about a "thread of control", but in
this case, there is no exclusion, thus no "thread of control".

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_11

(same link as a few posts ago)

-- 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 12:15:01 2011

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