[context] guarded_stack_allocator

I don't know if I've missed an earlier mailing list post on this topic, but why was guarded_stack_allocator removed from Boost.Context in the trunk? What should be used instead? The simple_stack_allocator that is an example, or some other general-purpose (no-guard-page) allocation function? -- Jeremiah Willcock

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).
participants (2)
-
Jeremiah Willcock
-
Oliver Kowalke