Electroneum
Public Types | Public Member Functions | Private Attributes | List of all members
tools::task_region_handle::state Struct Reference

Public Types

using id = unsigned
 

Public Member Functions

 state (std::shared_ptr< state > next_src) noexcept
 
 state (const state &)=default
 
 state (state &&)=default
 
 ~state ()=default
 
stateoperator= (const state &)=default
 
stateoperator= (state &&)=default
 
void track_id (id task_id) noexcept
 
bool can_run (id task_id) noexcept
 
void mark_completed (id task_id) noexcept
 Mark id as completed, and synchronize with waiting threads. More...
 
void abort () noexcept
 Tell all unstarted functions in region to return immediately. More...
 
void wait () noexcept
 Blocks until all functions in region have aborted or completed. More...
 
void wait (thread_group &threads) noexcept
 Same as wait(), except this_thread runs tasks while waiting. More...
 

Private Attributes

std::shared_ptr< statenext
 
std::atomic< idready
 Tracks whether a task has been invoked. More...
 
std::atomic< idpending
 Tracks when a task has completed or aborted. More...
 
boost::mutex sync_on_complete
 
boost::condition_variable all_complete
 

Member Typedef Documentation

◆ id

Constructor & Destructor Documentation

◆ state() [1/3]

tools::task_region_handle::state::state ( std::shared_ptr< state next_src)
inlineexplicitnoexcept

◆ state() [2/3]

tools::task_region_handle::state::state ( const state )
default

◆ state() [3/3]

tools::task_region_handle::state::state ( state &&  )
default

◆ ~state()

tools::task_region_handle::state::~state ( )
default

Member Function Documentation

◆ abort()

void tools::task_region_handle::state::abort ( )
noexcept

Tell all unstarted functions in region to return immediately.

◆ can_run()

bool tools::task_region_handle::state::can_run ( id  task_id)
inlinenoexcept
Returns
True only once whether a given id can execute

◆ mark_completed()

void tools::task_region_handle::state::mark_completed ( id  task_id)
noexcept

Mark id as completed, and synchronize with waiting threads.

◆ operator=() [1/2]

state& tools::task_region_handle::state::operator= ( const state )
default

◆ operator=() [2/2]

state& tools::task_region_handle::state::operator= ( state &&  )
default

◆ track_id()

void tools::task_region_handle::state::track_id ( id  task_id)
inlinenoexcept

◆ wait() [1/2]

void tools::task_region_handle::state::wait ( )
noexcept

Blocks until all functions in region have aborted or completed.

◆ wait() [2/2]

void tools::task_region_handle::state::wait ( thread_group threads)
noexcept

Same as wait(), except this_thread runs tasks while waiting.

Member Data Documentation

◆ all_complete

boost::condition_variable tools::task_region_handle::state::all_complete
private

◆ next

std::shared_ptr<state> tools::task_region_handle::state::next
private

◆ pending

std::atomic<id> tools::task_region_handle::state::pending
private

Tracks when a task has completed or aborted.

◆ ready

std::atomic<id> tools::task_region_handle::state::ready
private

Tracks whether a task has been invoked.

◆ sync_on_complete

boost::mutex tools::task_region_handle::state::sync_on_complete
private

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