Boost logo

Boost :

Subject: Re: [boost] [context] guarded_stack_allocator
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-11-29 02:36:46

It was an relict from obsolete version of boost.context (containing class
context etc.) - is a very low level library now.
boost.context does not really require to provide a stack-allocator because
make_fcontext() does only expect an pointer to the stack - no constraints
how the stack was allocated.

Some users asked why RAII was not used for stack-allocators, e.g. why not
allocate stack in ctor and deallocate in dtor of fcontext_t. Because
make_fcontext()/jump_fcontext() have
extern 'C' linkage fcontext_t is required to be extern 'C' too. This means
that fcontext_t must be a POD == ctor and dtor must not call functions.

I'm started to port boost.context to ARM-Cortex M0/3 and on systems running
on such hardware the stack-allocators could not be used (might not compile
at all).

Higher abstractions using boost.context should implement stack-allocation
(as boost.coroutine does - guard_stack_allocator can be found in this
library) - I think it isn't hard
to implement it (for instance like simple_stack_allocator).

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