BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
fc::context Struct Reference

#include <context.hpp>

Classes

struct  blocked_promise
 

Public Types

typedef fc::contextptr
 
using context_fn = void(*)(intptr_t)
 

Public Member Functions

 context (context_fn sf, stack_allocator &alloc, fc::thread *t)
 
 context (fc::thread *t)
 
 ~context ()
 
void reinitialize ()
 
void add_blocking_promise (promise_base *p, bool req=true)
 
bool try_unblock (promise_base *p)
 
void remove_blocking_promise (promise_base *p)
 
void timeout_blocking_promises ()
 
void set_exception_on_blocking_promises (const exception_ptr &e)
 
void clear_blocking_promises ()
 
bool is_complete () const
 

Public Attributes

bco::stack_context stack_ctx
 
bc::fcontext_t my_context
 
fc::contextcaller_context
 
stack_allocatorstack_alloc
 
priority prio
 
std::vector< blocked_promiseblocking_prom
 
time_point resume_time
 
fc::contextnext_blocked
 
fc::contextnext_blocked_mutex
 
fc::contextnext
 
fc::threadctx_thread
 
bool canceled
 
const char * cancellation_reason
 
bool complete
 
task_basecur_task
 
uint64_t context_posted_num
 

Detailed Description

maintains information associated with each context such as where it is blocked, what time it should resume, priority, etc.

Definition at line 47 of file context.hpp.

Member Typedef Documentation

using fc::context::context_fn = void(*)(intptr_t)

Definition at line 54 of file context.hpp.

Definition at line 48 of file context.hpp.

Constructor & Destructor Documentation

fc::context::context ( context_fn  sf,
stack_allocator alloc,
fc::thread t 
)
inline

Definition at line 57 of file context.hpp.

fc::context::context ( fc::thread t)
inline

Definition at line 77 of file context.hpp.

fc::context::~context ( )
inline

Definition at line 94 of file context.hpp.

Member Function Documentation

void fc::context::add_blocking_promise ( promise_base p,
bool  req = true 
)
inline
Todo:
Have a list of promises so that we can wait for P1 or P2 and either will unblock instead of requiring both
Parameters
req- require this promise to 'unblock', otherwise try_unblock will allow it to be one of many that could 'unblock'

Definition at line 128 of file context.hpp.

void fc::context::clear_blocking_promises ( )
inline

Definition at line 176 of file context.hpp.

bool fc::context::is_complete ( ) const
inline

Definition at line 180 of file context.hpp.

void fc::context::reinitialize ( )
inline

Definition at line 99 of file context.hpp.

void fc::context::remove_blocking_promise ( promise_base p)
inline

Definition at line 157 of file context.hpp.

void fc::context::set_exception_on_blocking_promises ( const exception_ptr e)
inline

Definition at line 171 of file context.hpp.

void fc::context::timeout_blocking_promises ( )
inline

Definition at line 166 of file context.hpp.

bool fc::context::try_unblock ( promise_base p)
inline

If all of the required promises and any optional promises then return true, else false.

Todo:
check list

Definition at line 142 of file context.hpp.

Member Data Documentation

std::vector<blocked_promise> fc::context::blocking_prom

Definition at line 187 of file context.hpp.

fc::context* fc::context::caller_context

Definition at line 183 of file context.hpp.

bool fc::context::canceled

Definition at line 194 of file context.hpp.

const char* fc::context::cancellation_reason

Definition at line 196 of file context.hpp.

bool fc::context::complete

Definition at line 198 of file context.hpp.

uint64_t fc::context::context_posted_num

Definition at line 200 of file context.hpp.

fc::thread* fc::context::ctx_thread

Definition at line 193 of file context.hpp.

task_base* fc::context::cur_task

Definition at line 199 of file context.hpp.

bc::fcontext_t fc::context::my_context

Definition at line 182 of file context.hpp.

fc::context* fc::context::next

Definition at line 192 of file context.hpp.

fc::context* fc::context::next_blocked

Definition at line 190 of file context.hpp.

fc::context* fc::context::next_blocked_mutex

Definition at line 191 of file context.hpp.

priority fc::context::prio

Definition at line 185 of file context.hpp.

time_point fc::context::resume_time

Definition at line 188 of file context.hpp.

stack_allocator* fc::context::stack_alloc

Definition at line 184 of file context.hpp.

bco::stack_context fc::context::stack_ctx

Definition at line 49 of file context.hpp.


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