2
0
mirror of https://github.com/boostorg/context.git synced 2026-02-02 08:42:15 +00:00

fcontext uses 'void*' for data transfer

This commit is contained in:
Oliver Kowalke
2015-11-28 22:58:36 +01:00
parent c70440f0ff
commit 4d68f47767
12 changed files with 134 additions and 246 deletions

View File

@@ -25,34 +25,26 @@ ctx::fcontext_t fcm = 0;
ctx::fcontext_t fc1 = 0;
ctx::fcontext_t fc2 = 0;
void f2( intptr_t)
{
void f2( void *) {
std::cout << "f2: entered" << std::endl;
ctx::jump_fcontext( & fc2, fc1, 0);
}
void f1( intptr_t)
{
void f1( void *) {
std::cout << "f1: entered" << std::endl;
stack_allocator alloc;
void * sp = alloc.allocate( stack_allocator::default_stacksize());
fc2 = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f2);
ctx::jump_fcontext( & fc1, fc2, 0);
ctx::jump_fcontext( & fc1, fcm, 0);
}
int main( int argc, char * argv[])
{
int main( int argc, char * argv[]) {
stack_allocator alloc;
void * sp = alloc.allocate( stack_allocator::default_stacksize());
fc1 = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f1);
std::cout << "main: call start_fcontext( & fcm, fc1, 0)" << std::endl;
ctx::jump_fcontext( & fcm, fc1, 0);
std::cout << "main: done" << std::endl;
return EXIT_SUCCESS;
}