Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

single-producer/consumer bounded queue in Relacy...

6 views
Skip to first unread message

Chris M. Thomasson

unread,
Apr 26, 2009, 1:09:08 AM4/26/09
to
Here is the code:

http://relacy.pastebin.com/f6911ad8e

This uses eventcounts to allow for blocking on queue full/empty conditions.


Enjoy!

Dmitriy Vyukov

unread,
Apr 27, 2009, 4:27:12 AM4/27/09
to


I've noticed there is a line:
unsigned state_workaround = f->m_state($); // Relacy Bug?
What do you mean here? I can't catch up at a moment...


Also I've noticed that you zeroize buffer in ctor:
for (std::size_t i = 0; i < T_size; ++i) {
m_buffer[i]($) = T();
}
Is it required? IMHO it's better to leave as many variables
uninitialized as possible, because it's allows more possibilities for
automatic error detection.


--
Dmitriy V'jukov

Chris M. Thomasson

unread,
Apr 27, 2009, 6:54:54 AM4/27/09
to
"Dmitriy Vyukov" <dvy...@gmail.com> wrote in message
news:df2f6bc5-2c41-4fa7...@x31g2000prc.googlegroups.com...

On 26 О©╫О©╫О©╫, 09:09, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> > Here is the code:
> >
> > http://relacy.pastebin.com/f6911ad8e
> >
> > This uses eventcounts to allow for blocking on queue full/empty
> > conditions.


> I've noticed there is a line:
> unsigned state_workaround = f->m_state($); // Relacy Bug?
> What do you mean here? I can't catch up at a moment...

Here is an example of what I seem to have found:

http://relacy.pastebin.com/f34a14497


Run the test in Debug mode as-is and examine the output for a couple of
seconds... Then, uncomment the `EXPOSE_POSSIBLE_BUG' macro, run the test
again and examine the output. Instead of printing the actual value of the
`foo::m_state' member, it seems to print out a pointer value or something.
Can you reproduce the behavior on your end?


> Also I've noticed that you zeroize buffer in ctor:
> for (std::size_t i = 0; i < T_size; ++i) {
> m_buffer[i]($) = T();
> }
> Is it required?

Nope, its not required. I forgot why I was doing that in the first place.
Yikes!

;^/


> IMHO it's better to leave as many variables
> uninitialized as possible, because it's allows more possibilities for
> automatic error detection.

Agreed.

0 new messages