Boost logo

Boost :

Subject: Re: [boost] [coroutine] : My Confusion
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-05-09 02:03:25

Hi Chris,

> In the past, I would always pass a pointer to an abstraction of the
> context to an assembly routine that was responsible for
> * context-save
> * task switch
> * context-restore and task re-schedule

> Where are these things in
> Boost.Coroutine?
> Where is the low-level assembly that does the *nuts-and-bolts*
> of the context switching?

boost.context contains struct fcontext_t storing the architecture+ABI specific stuff (registers) and functions make_fcontext() and jump_fcontext(). The first function is used to set up a fcontext_t and the second one is used to jump from one context to another one. Both functions are written in assembler.

Template coroutine aggregates two fcontext's.
One to store the relevant registers form the calling context and the second struct contains the register stuff of the to called context (coroutines context, coroutine's funtion).

> Or am I just totally confused here? Are you doing it in
> a high-level abstraction that I simply don't understand?
> Are you using proprocessor macros to do the context switch?

it's assembler code (no inline assembler).

> Where is the assembler stuff?


so long,

NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren:

Boost list run by bdawes at, gregod at, cpdaniel at, john at