35 #ifdef LIBCOTASK_MACRO_ENABLED
40 std::chrono::milliseconds dura(4);
41 std::this_thread::sleep_for(dura);
83 std::vector<std::thread> th_pool;
85 for (
int i = 0; i < 5; ++i) {
86 co_arr[i] = co_type::create(&runners[i], 128 * 1024);
92 for (std::thread &th : th_pool) {
128 co_type::ptr_t co = co_type::create(&runner, 128 * 1024);
148 if (
nullptr == co_startup[0]) {
191 co_type *co_startup[2] = {
nullptr};
196 co_type::ptr_t co1, co2;
197 co1 = co_type::create(&cor1, 128 * 1024);
198 co2 = co_type::create(&cor2, 128 * 1024);
199 cor1.
owner = co1.get();
200 cor2.
owner = co2.get();
207 co1->start(co_startup);
211 co1->resume(co_startup);
225 value_type *ptr = copp::this_coroutine::get<value_type>();
234 int res = co_jump->start(ptr);
251 co_type::ptr_t co1, co2;
252 co1 = co_type::create(&cor1, 128 * 1024);
253 co2 = co_type::create(&cor2, 128 * 1024);
256 co1->start(co2.get());
int operator()(void *passed)
test_this_context_get_cotoutine_runner()
static std::atomic_int cur_thd_count
void set_co_obj(value_ptr_type addr)
copp::coroutine_context_default value_type
static int get_max_thd_count()
value_type * value_ptr_type
test_this_context_yield_runner()
value_type * value_ptr_type
copp::coroutine_context_default value_type
coroutine_context_container< allocator::default_statck_allocator > coroutine_context_default
CASE_TEST(this_context, get_coroutine)
static void test_this_context_thread_func(copp::coroutine_context_default::ptr_t co, test_this_context_get_cotoutine_runner *runner)
@ COPP_EC_IS_RUNNING
COPP_EC_IS_RUNNING.
LIBCOPP_COPP_API int yield(void **priv_data=nullptr) LIBCOPP_MACRO_NOEXCEPT
yield current coroutine
LIBCOPP_COPP_API coroutine_context * get_coroutine() LIBCOPP_MACRO_NOEXCEPT
get current coroutine
LIBCOPP_COTASK_API impl::task_impl * get_task() LIBCOPP_MACRO_NOEXCEPT
get current running task
copp::coroutine_context_default::ptr_t * co_arr
copp::coroutine_context_default value_type
int operator()(void *co_startup_raw)
test_this_context_rec_runner()
value_type * value_ptr_type
test_this_context_rec_runner * jump_to
int operator()(void *pco2)
copp::coroutine_context_default value_type
test_this_context_start_failed_when_running()
#define CASE_EXPECT_FALSE(c)
#define CASE_EXPECT_EQ(l, r)
#define CASE_EXPECT_NE(l, r)
#define CASE_EXPECT_LT(l, r)
#define CASE_EXPECT_TRUE(c)