Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::internal::co_context Class Reference

#include <co_context.h>

Collaboration diagram for tbb::internal::co_context:

Public Member Functions

 co_context (size_t stack_size, void *arg)
 
 ~co_context ()
 
void resume (co_context &target)
 
voidget_stack_limit ()
 

Private Types

enum  co_state { co_invalid, co_suspended, co_executing, co_destroyed }
 

Private Attributes

coroutine_type my_coroutine
 
co_state my_state
 

Detailed Description

Definition at line 72 of file co_context.h.

Member Enumeration Documentation

◆ co_state

Enumerator
co_invalid 
co_suspended 
co_executing 
co_destroyed 

Definition at line 73 of file co_context.h.

Constructor & Destructor Documentation

◆ co_context()

tbb::internal::co_context::co_context ( size_t  stack_size,
void arg 
)
inline

Definition at line 83 of file co_context.h.

85  {
86  if (arg) {
87  create_coroutine(my_coroutine, stack_size, arg);
88  } else {
90  }
91  }
coroutine_type my_coroutine
Definition: co_context.h:79
void create_coroutine(coroutine_type &c, size_t stack_size, void *arg)
Definition: co_context.h:154
void current_coroutine(coroutine_type &c)
Definition: co_context.h:184

References tbb::internal::create_coroutine(), tbb::internal::current_coroutine(), and my_coroutine.

Here is the call graph for this function:

◆ ~co_context()

tbb::internal::co_context::~co_context ( )
inline

Definition at line 93 of file co_context.h.

93  {
94  __TBB_ASSERT(1 << my_state & (1 << co_suspended | 1 << co_executing), NULL);
95  if (my_state == co_suspended)
98  }
void destroy_coroutine(coroutine_type &c)
Definition: co_context.h:194
coroutine_type my_coroutine
Definition: co_context.h:79
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

References __TBB_ASSERT, co_destroyed, co_executing, co_suspended, tbb::internal::destroy_coroutine(), my_coroutine, and my_state.

Here is the call graph for this function:

Member Function Documentation

◆ get_stack_limit()

void* tbb::internal::co_context::get_stack_limit ( )
inline

Definition at line 114 of file co_context.h.

114  {
115  return my_coroutine.my_stack;
116  }
coroutine_type my_coroutine
Definition: co_context.h:79

References my_coroutine, and tbb::internal::coroutine_type::my_stack.

◆ resume()

void tbb::internal::co_context::resume ( co_context target)
inline

Definition at line 100 of file co_context.h.

100  {
101  // Do not create non-trivial objects on the stack of this function. They might never be destroyed.
103  __TBB_ASSERT(target.my_state == co_suspended, NULL);
104 
106  target.my_state = co_executing;
107 
108  // 'target' can reference an invalid object after swap_coroutine. Do not access it.
109  swap_coroutine(my_coroutine, target.my_coroutine);
110 
112  }
coroutine_type my_coroutine
Definition: co_context.h:79
void swap_coroutine(coroutine_type &prev_coroutine, coroutine_type &new_coroutine)
Definition: co_context.h:189
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

References __TBB_ASSERT, co_executing, co_suspended, my_coroutine, my_state, and tbb::internal::swap_coroutine().

Here is the call graph for this function:

Member Data Documentation

◆ my_coroutine

coroutine_type tbb::internal::co_context::my_coroutine
private

Definition at line 79 of file co_context.h.

Referenced by co_context(), get_stack_limit(), resume(), and ~co_context().

◆ my_state

co_state tbb::internal::co_context::my_state
private

Definition at line 80 of file co_context.h.

Referenced by resume(), and ~co_context().


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

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.