$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] boost.lockfree update
From: Tim Blechmann (tim_at_[hidden])
Date: 2010-07-24 16:07:44
>>> 3. For the empty() method, it says "Not thread-safe, use for debugging
>>> purposes only". Does this mean calling it might destroy the data
>>> structure's invariants? Or is it always safe in that regard? In which
>>> scenarios can it be used, specifically?
>>>
>> calling it may return a wrong result. the data structure is not
>> corrupted.
>>
> Am I right in assuming that the result it produces is correct when it is
> produced, and the only problem is that something could get added to the
> queue before the caller gets a chance to examine the result?
for empty(), the following steps need to be done:
1. atomically load the head pointer
2. atomically load the tail pointer
3. compare the pointers.
if the state of the fifo is changed between steps 1 and 2, the result
doesn't reflect the state of the fifo anymore ...
tim
-- tim_at_[hidden] http://tim.klingt.org After one look at this planet any visitor from outer space would say "I want to see the manager." William S. Burroughs