pstore2
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
pstore::heartbeat Class Reference

Classes

class  worker_thread
 

Public Types

using key_type = std::uintptr_t
 A key_type value is used to distinguish between different callbacks that are attached to the heartbeat thread. More...
 
using callback = std::function< void(key_type)>
 

Public Member Functions

 heartbeat (heartbeat const &)=delete
 
heartbeatoperator= (heartbeat const &)=delete
 
void attach (key_type key, callback cb)
 
void detach (key_type key)
 
void stop ()
 Stops the heartbeat thread.
 

Static Public Member Functions

static std::shared_ptr< heartbeatget ()
 
template<typename T >
static key_type to_key_type (T *t)
 A small convenience function which will convert a pointer to key_type.
 

Member Typedef Documentation

◆ key_type

using pstore::heartbeat::key_type = std::uintptr_t

A key_type value is used to distinguish between different callbacks that are attached to the heartbeat thread.

When attaching a callback, provide a unique that identifies it. This same value is passed to the function when it is called and may be used as the argument to detach() when it is time so stop that callback being invoked.


The documentation for this class was generated from the following files: