OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia::net::lifetime_token Struct Reference

Detailed Description

Liveness token for a socket's asio completion handlers.

Closing a descriptor does not make asio forget the operations pending on it: they complete with operation_aborted on a later poll(), often after the owner is gone. Handlers capture this, so they take a weak reference to this token and give up once it has expired.

Held by value in the tracked object, hence non-copyable.

Public Member Functions

 lifetime_token (const lifetime_token &)=delete
 
 lifetime_token (lifetime_token &&)=delete
 
lifetime_tokenoperator= (const lifetime_token &)=delete
 
lifetime_tokenoperator= (lifetime_token &&)=delete
 
std::weak_ptr< void > watch () const noexcept
 
void reset () noexcept
 

Member Function Documentation

◆ reset()

void ossia::net::lifetime_token::reset ( )
inlinenoexcept

Expire every watch. Members die after the destructor body, so a socket closing itself there still looks alive unless this is called first.