2
0
mirror of https://github.com/boostorg/context.git synced 2026-01-25 06:02:16 +00:00

context: simple_stack_allocator moved to examples directory, guarded_stack_allocator removed

[SVN r81346]
This commit is contained in:
Oliver Kowalke
2012-11-14 17:30:45 +00:00
parent 45f16dffc8
commit dbfeda223d
16 changed files with 107 additions and 755 deletions

View File

@@ -13,8 +13,16 @@
#include <boost/assert.hpp>
#include <boost/context/all.hpp>
#include "simple_stack_allocator.hpp"
namespace ctx = boost::context;
typedef ctx::simple_stack_allocator<
8 * 1024 * 1024, // 8MB
64 * 1024, // 64kB
8 * 1024 // 8kB
> stack_allocator;
ctx::fcontext_t fcm;
ctx::fcontext_t * fc1;
@@ -31,11 +39,10 @@ void f1( intptr_t param)
int main( int argc, char * argv[])
{
typedef ctx::simple_stack_allocator< 256 * 1024, 64 * 1024, 8 * 1024 > alloc_t;
alloc_t alloc;
stack_allocator alloc;
void * sp = alloc.allocate(alloc_t::default_stacksize());
fc1 = ctx::make_fcontext( sp, alloc_t::default_stacksize(), f1);
void * sp = alloc.allocate( stack_allocator::default_stacksize() );
fc1 = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f1);
pair_t p( std::make_pair( 2, 7) );
int res = ( int) ctx::jump_fcontext( & fcm, fc1, ( intptr_t) & p);