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

#include <context.hpp>


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
priority prio
std::vector< blocked_promiseblocking_prom
time_point resume_time
bool canceled
const char * cancellation_reason
bool complete
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

◆ context_fn

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

Definition at line 54 of file context.hpp.

◆ ptr

Definition at line 48 of file context.hpp.

Constructor & Destructor Documentation

◆ context() [1/2]

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

Definition at line 57 of file context.hpp.

◆ context() [2/2]

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

Definition at line 77 of file context.hpp.

◆ ~context()

fc::context::~context ( )

Definition at line 94 of file context.hpp.

Member Function Documentation

◆ add_blocking_promise()

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

Definition at line 129 of file context.hpp.

◆ clear_blocking_promises()

void fc::context::clear_blocking_promises ( )

Definition at line 177 of file context.hpp.

◆ is_complete()

bool fc::context::is_complete ( ) const

Definition at line 181 of file context.hpp.

◆ reinitialize()

void fc::context::reinitialize ( )

Definition at line 99 of file context.hpp.

◆ remove_blocking_promise()

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

Definition at line 158 of file context.hpp.

◆ set_exception_on_blocking_promises()

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

Definition at line 172 of file context.hpp.

◆ timeout_blocking_promises()

void fc::context::timeout_blocking_promises ( )

Definition at line 167 of file context.hpp.

◆ try_unblock()

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

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

check list

Definition at line 143 of file context.hpp.

Member Data Documentation

◆ blocking_prom

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

Definition at line 188 of file context.hpp.

◆ caller_context

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

Definition at line 184 of file context.hpp.

◆ canceled

bool fc::context::canceled

Definition at line 195 of file context.hpp.

◆ cancellation_reason

const char* fc::context::cancellation_reason

Definition at line 197 of file context.hpp.

◆ complete

bool fc::context::complete

Definition at line 199 of file context.hpp.

◆ context_posted_num

uint64_t fc::context::context_posted_num

Definition at line 201 of file context.hpp.

◆ ctx_thread

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

Definition at line 194 of file context.hpp.

◆ cur_task

task_base* fc::context::cur_task

Definition at line 200 of file context.hpp.

◆ my_context

bc::fcontext_t fc::context::my_context

Definition at line 183 of file context.hpp.

◆ next

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

Definition at line 193 of file context.hpp.

◆ next_blocked

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

Definition at line 191 of file context.hpp.

◆ next_blocked_mutex

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

Definition at line 192 of file context.hpp.

◆ prio

priority fc::context::prio

Definition at line 186 of file context.hpp.

◆ resume_time

time_point fc::context::resume_time

Definition at line 189 of file context.hpp.

◆ stack_alloc

stack_allocator* fc::context::stack_alloc

Definition at line 185 of file context.hpp.

◆ stack_ctx

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: