Skip to content

Commit afecffc

Browse files
Fix transfer_t struct missing (#5303)
* Fix missing transfer_t * Fix missing transfer_t
1 parent 0890024 commit afecffc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

include/swoole_coroutine_context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ class Context {
9090
void *private_data_;
9191
bool end_;
9292

93-
#if USE_UCONTEXT
93+
#if defined(USE_UCONTEXT) || defined(SW_USE_THREAD_CONTEXT)
9494
static void context_func(void *arg);
9595
#else
96-
static void context_func(transfer_t arg);
96+
static void context_func(coroutine_transfer_t arg);
9797
#endif
9898
};
9999

src/coroutine/context.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Context::Context(size_t stack_size, CoroutineFunc fn, void *private_data)
5757
valgrind_stack_id = VALGRIND_STACK_REGISTER(sp, stack_);
5858
#endif
5959

60-
#if USE_UCONTEXT
60+
#ifdef USE_UCONTEXT
6161
if (-1 == getcontext(&ctx_)) {
6262
swoole_throw_error(SW_ERROR_CO_GETCONTEXT_FAILED);
6363
sw_free(stack_);
@@ -120,7 +120,7 @@ ssize_t Context::get_stack_usage() {
120120
#endif
121121

122122
bool Context::swap_in() {
123-
#if USE_UCONTEXT
123+
#ifdef USE_UCONTEXT
124124
return 0 == swapcontext(&swap_ctx_, &ctx_);
125125
#else
126126
coroutine_transfer_t transfer_data = swoole_jump_fcontext(ctx_, (void *) this);
@@ -130,7 +130,7 @@ bool Context::swap_in() {
130130
}
131131

132132
bool Context::swap_out() {
133-
#if USE_UCONTEXT
133+
#ifdef USE_UCONTEXT
134134
return 0 == swapcontext(&ctx_, &swap_ctx_);
135135
#else
136136
coroutine_transfer_t transfer_data = swoole_jump_fcontext(swap_ctx_, (void *) this);
@@ -140,11 +140,11 @@ bool Context::swap_out() {
140140
}
141141

142142
void Context::context_func(
143-
#if USE_UCONTEXT
143+
#if defined(USE_UCONTEXT) || defined(SW_USE_THREAD_CONTEXT)
144144
void *arg) {
145145
auto *_this = (Context *) arg;
146146
#else
147-
transfer_t arg) {
147+
coroutine_transfer_t arg) {
148148
auto *_this = (Context *) arg.data;
149149
_this->swap_ctx_ = arg.fctx;
150150
#endif

0 commit comments

Comments
 (0)