Skip to content

Commit

Permalink
cmake: add boost_lockfree_test_common for better ide integration
Browse files Browse the repository at this point in the history
  • Loading branch information
timblechmann committed Dec 1, 2023
1 parent fcc0ecb commit 16e236b
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions include/boost/lockfree/spsc_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ namespace lockfree {
/** The spcs_value provides a single-writer/single-reader value, implemented by a triple buffer
*
* \b Policies:
* - \ref boost::lockfree::allow_multiple_reads, defaults to \c boost::lockfree::allow_multiple_reads<false> \n
* - \ref boost::lockfree::allow_multiple_reads, defaults to
* \ref boost::lockfree::allow_multiple_reads "boost::lockfree::allow_multiple_reads<false>" \n
* If multiple reads are allowed, a value written to the spsc_value can be read multiple times, but not moved out
* of the instance. If multiple reads are not allowed, the class works as single-element queue that overwrites on
* write
Expand All @@ -62,15 +63,16 @@ struct spsc_value
public:
#endif

/** Construct a spcs_value
/** Construct a \ref boost::lockfree::spsc_value "spsc_value"
*
* If configured with allow_multiple_reads<true> it is initialized to a default-constructed value
* If configured with \ref boost::lockfree::allow_multiple_reads "boost::lockfree::allow_multiple_reads<true>" it
* is initialized to a default-constructed value
*
* */
explicit spsc_value()
{}

/** Construct a spcs_value, initialized to a value
/** Construct a \ref boost::lockfree::spsc_value "spsc_value", initialized to a value
* */
explicit spsc_value( T value ) :
m_write_index {
Expand All @@ -86,10 +88,10 @@ struct spsc_value
m_buffer[ 0 ].value = std::move( value );
}

/** Writes an object to the value.
/** Writes `value` to the \ref boost::lockfree::spsc_value "spsc_value"
*
* \pre only one thread is allowed to write data to the spcs_value
* \post object will be written to the spsc_queue
* \pre only one thread is allowed to write data to the \ref boost::lockfree::spsc_value "spsc_value"
* \post object will be written to the \ref boost::lockfree::spsc_value "spsc_value"
*
* \note Thread-safe and wait-free
* */
Expand All @@ -106,12 +108,13 @@ struct spsc_value
swap_write_buffer();
}

/** Reads an object from the value.
/** Reads content of the \ref boost::lockfree::spsc_value "spsc_value"
*
* \pre only one thread is allowed to write data to the spcs_value
* \post if read operation is successful, object will be copied to ret.
* \returns true, if the read operation is successful, false if the spsc_value is configured with
* allow_multiple_reads<false> and no value is available for reading
* \pre only one thread is allowed to write data to the \ref boost::lockfree::spsc_value "spsc_value"
* \post if read operation is successful, object will be copied to `ret`.
* \returns `true`, if the read operation is successful, false if the \ref boost::lockfree::spsc_value "spsc_value" is
* configured with \ref boost::lockfree::allow_multiple_reads
* "boost::lockfree::allow_multiple_reads<false>" and no value is available for reading
*
* \note Thread-safe and wait-free
* */
Expand All @@ -138,7 +141,7 @@ struct spsc_value
*
* reads element from the spsc_value and applies the functor on this object
*
* \returns true, if element was consumed
* \returns `true`, if element was consumed
*
* \note Thread-safe and non-blocking, if functor is thread-safe and non-blocking
* */
Expand Down

0 comments on commit 16e236b

Please sign in to comment.