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

Enumerator
co_invalid 
co_suspended 
co_executing 
co_destroyed 

Definition at line 73 of file co_context.h.

Constructor & Destructor Documentation

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

Definition at line 83 of file co_context.h.

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

85  {
86  if (arg) {
87  create_coroutine(my_coroutine, stack_size, arg);
88  } else {
90  }
91  }
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
coroutine_type my_coroutine
Definition: co_context.h:79

Here is the call graph for this function:

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

Definition at line 93 of file co_context.h.

References __TBB_ASSERT, and tbb::internal::destroy_coroutine().

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

Here is the call graph for this function:

Member Function Documentation

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

Definition at line 100 of file co_context.h.

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

Referenced by tbb::internal::generic_scheduler::free_task().

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  }
void swap_coroutine(coroutine_type &prev_coroutine, coroutine_type &new_coroutine)
Definition: co_context.h:189
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

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 79 of file co_context.h.

Referenced by resume().

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

Definition at line 80 of file co_context.h.

Referenced by resume().


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.