mirror of https://gitee.com/openkylin/qemu.git
coroutine: add a macro for the coroutine stack size
Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
be87a393f9
commit
8adcd6fb6d
|
@ -28,6 +28,8 @@
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu/coroutine.h"
|
#include "qemu/coroutine.h"
|
||||||
|
|
||||||
|
#define COROUTINE_STACK_SIZE (1 << 20)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
COROUTINE_YIELD = 1,
|
COROUTINE_YIELD = 1,
|
||||||
COROUTINE_TERMINATE = 2,
|
COROUTINE_TERMINATE = 2,
|
||||||
|
|
|
@ -143,7 +143,7 @@ static void coroutine_trampoline(int signal)
|
||||||
|
|
||||||
Coroutine *qemu_coroutine_new(void)
|
Coroutine *qemu_coroutine_new(void)
|
||||||
{
|
{
|
||||||
const size_t stack_size = 1 << 20;
|
const size_t stack_size = COROUTINE_STACK_SIZE;
|
||||||
CoroutineSigAltStack *co;
|
CoroutineSigAltStack *co;
|
||||||
CoroutineThreadState *coTS;
|
CoroutineThreadState *coTS;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
|
@ -82,7 +82,7 @@ static void coroutine_trampoline(int i0, int i1)
|
||||||
|
|
||||||
Coroutine *qemu_coroutine_new(void)
|
Coroutine *qemu_coroutine_new(void)
|
||||||
{
|
{
|
||||||
const size_t stack_size = 1 << 20;
|
const size_t stack_size = COROUTINE_STACK_SIZE;
|
||||||
CoroutineUContext *co;
|
CoroutineUContext *co;
|
||||||
ucontext_t old_uc, uc;
|
ucontext_t old_uc, uc;
|
||||||
sigjmp_buf old_env;
|
sigjmp_buf old_env;
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void CALLBACK coroutine_trampoline(void *co_)
|
||||||
|
|
||||||
Coroutine *qemu_coroutine_new(void)
|
Coroutine *qemu_coroutine_new(void)
|
||||||
{
|
{
|
||||||
const size_t stack_size = 1 << 20;
|
const size_t stack_size = COROUTINE_STACK_SIZE;
|
||||||
CoroutineWin32 *co;
|
CoroutineWin32 *co;
|
||||||
|
|
||||||
co = g_malloc0(sizeof(*co));
|
co = g_malloc0(sizeof(*co));
|
||||||
|
|
Loading…
Reference in New Issue