Skip to content

Commit

Permalink
Improve documentation for pool iteration function. (#17921)
Browse files Browse the repository at this point in the history
There are constraints on what mutations can be done while iterating
that were not documented.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Nov 27, 2023
1 parent 775439e commit 3353729
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/lib/support/Pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,15 @@ class BitMapObjectPool : public internal::StaticAllocatorBitmap, public internal
* @brief
* Run a functor for each active object in the pool
*
* @param function The functor of type `Loop (*)(T*)`, return Loop::Break to break the iteration
* @return Loop Returns Break or Finish according to the iteration
* @param function A functor of type `Loop (*)(T*)`.
* Return Loop::Break to break the iteration.
* The only modification the functor is allowed to make
* to the pool before returning is releasing the
* object that was passed to the functor. Any other
* desired changes need to be made after iteration
* completes.
* @return Loop Returns Break if some call to the functor returned
* Break. Otherwise returns Finish.
*
* caution
* this function is not thread-safe, make sure all usage of the
Expand Down Expand Up @@ -365,8 +372,15 @@ class HeapObjectPool : public internal::Statistics, public internal::PoolCommon<
* @brief
* Run a functor for each active object in the pool
*
* @param function The functor of type `Loop (*)(T*)`, return Loop::Break to break the iteration
* @return Loop Returns Break or Finish according to the iteration
* @param function A functor of type `Loop (*)(T*)`.
* Return Loop::Break to break the iteration.
* The only modification the functor is allowed to make
* to the pool before returning is releasing the
* object that was passed to the functor. Any other
* desired changes need to be made after iteration
* completes.
* @return Loop Returns Break if some call to the functor returned
* Break. Otherwise returns Finish.
*/
template <typename Function>
Loop ForEachActiveObject(Function && function)
Expand Down

0 comments on commit 3353729

Please sign in to comment.