W***o 发帖数: 6519 | 1 跟各位请教一下 这个makecontext() 函数,比如我有下面的代码:
ucontext_t ctx_a;
void function1()
{
// do something
printf("this is the output of function1()");
}
makecontext(&ctx_a, (void*)&function1, 0);
这个makecontext是永远的把function1()函数附加在context ctx_a上了吗? 如果是这
样的话,在Main() 里面做swapcontext(&Main, &ctx_a) 就还是会显示function1() 的
output对不对?
我写了code,似乎我这种想法是正确的,只是想和这里的高手确认一下。谢谢 | n*****t 发帖数: 22014 | 2 makecontext will call function1,also you dont need put & in front of
function1
【在 W***o 的大作中提到】 : 跟各位请教一下 这个makecontext() 函数,比如我有下面的代码: : ucontext_t ctx_a; : void function1() : { : // do something : printf("this is the output of function1()"); : } : makecontext(&ctx_a, (void*)&function1, 0); : 这个makecontext是永远的把function1()函数附加在context ctx_a上了吗? 如果是这 : 样的话,在Main() 里面做swapcontext(&Main, &ctx_a) 就还是会显示function1() 的
|
|