cycle_ptr
|
GC operations for delayed collection. More...
#include <util.h>
Public Member Functions | |
constexpr | gc_operation () noexcept=default |
Default constructor performs no collections. | |
gc_operation (detail::intrusive_ptr< detail::generation > g) noexcept | |
Constructor for internal use. | |
auto | operator() () noexcept -> void |
Run the GC. More... | |
Related Functions | |
(Note that these are not member functions.) | |
using | delay_gc = std::function< void(gc_operation)> |
Function for delayed GC invocations. More... | |
auto | get_delay_gc () -> delay_gc |
Read the current delay_gc function. More... | |
auto | set_delay_gc (delay_gc f) -> delay_gc |
Set the delay_gc function. More... | |
GC operations for delayed collection.
This functor invokes a garbage collect for a given generation.
Multiple invocations of this functor are idempotent.
|
inlinenoexcept |
Run the GC.
Multiple calls to this method are idempotent.
|
related |
Function for delayed GC invocations.
This function is passed a function object representing a GC invocation. It should ensure this function object will be executed at least once, at some point.
Multiple GC requests may occur, for multiple generations. However, a single generation will not issue a secondary request until the GC operation has started.
Calling get_delay_gc() or set_delay_gc() during this function will result in dead lock.
If the delay_gc function throws an exception, the code will swallow that exception and execute the GC operation immediately. If the function returns normally, it has responsibility for executing the gc_operation argument.
|
related |
Read the current delay_gc function.
Returns the currently installed delay_gc function. Any GC requests will be submitted to the installed function.
If the returned function is empty (i.e. nullptr
), GC operations are not delayed.
Set the delay_gc function.
This method synchronizes with all its invocations, ensuring that no calls to the old function are in progress when this function returns.
This could for example be used in combination with boost::asio
, to submit GC operations:
[in] | f | The function to install for delayed GC. Future GC requests will post using the installed function If the function is empty (i.e. |