Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. C/C++
  4. Async & concurrency
  5. pw_async2
  6. Futures
  7. pw::async2::ValueFuture< void > Class Reference
Loading...
Searching...
No Matches
pw::async2::ValueFuture< void > Class Reference

Overview

Specialization for a future that does not return any value, just a completion signal.

Public Types

using value_type = void
 

Public Member Functions

 ValueFuture (ValueFuture &&other) noexcept
 
ValueFuture & operator= (ValueFuture &&other) noexcept
 
void Cancel ()
 
Poll Pend (Context &cx)
 
bool is_pendable () const
 
bool is_complete () const
 

Static Public Member Functions

static ValueFuture Resolved ()
 

Protected Member Functions

void MoveFrom (ValueFuture &other)
 
template<typename Fn >
void MoveFrom (ValueFuture &other, Fn &&move_members)
 

Friends

class ValueProvider< void >
 
class BroadcastValueProvider< void >
 
template<typename DerivedFuture >
class DerivedValueProvider
 
template<typename U , typename FutureType >
class ValueListProvider
 

Member Function Documentation

◆ Cancel()

void pw::async2::ValueFuture< void >::Cancel ( )
inline

Cancels the future.

Always call Cancel() in the destructor of any class derived from ValueFuture to ensure the future is unlisted before the derived class members are destroyed.

◆ MoveFrom() [1/2]

void pw::async2::ValueFuture< void >::MoveFrom ( ValueFuture< void > &  other)
inlineprotected

Moves the base ValueFuture from other while holding the provider lock.

Use this overload when moving a ValueFuture or a derived future that has no additional state accessed by the provider. If the derived class has member variables that may be inspected by the provider (e.g., via ResolveIf or ResolveFirstMatching), use MoveFrom(other, move_members) instead so that those members are moved atomically under the same lock acquisition.

◆ MoveFrom() [2/2]

template<typename Fn >
void pw::async2::ValueFuture< void >::MoveFrom ( ValueFuture< void > &  other,
Fn &&  move_members 
)
inlineprotected

Moves the base ValueFuture from other and invokes move_members while holding the provider lock.

Always call MoveFrom in the move constructor and move assignment operator of any class derived from ValueFuture to ensure derived class members are initialized before a concurrent provider operation can access the moved-to future.


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