Boost logo

Boost :

Subject: Re: [boost] [context] new version - support for Win64
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2011-01-15 10:03:10

----- Original Message -----
From: "Oliver Kowalke" <k-oli_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, December 18, 2010 10:01 PM
Subject: Re: [boost] [context] new version - support for Win64

> Am 18.12.2010 21:30, schrieb Andrzej Krzemienski:
>>> I've uploaded to boost vault.
>> Hi,
>> I am new to the idea of context switching, and the idea seams very
>> interesting. I have gotone question regarding the interface. The two
>> arguments that are passed when creating a new context, of type
>> void(*)(void*) and void* look like a way of providing a callback. I am used
>> to, in Boost libraries and C++0x threads, to see function<void()> as a type
>> of callbcak. Is there a reason for not using it in case of context
>> switching?
> using a simple function pointer and a void * as its argument makes the
> implementation in assembler easier.
> boost.context is intended to be the basis of such things like coroutines
> (see boost.coroutine) and fibers (see boost.fiber).
> Both libs allow to use arbitrary function objects.

I understand the rationale. Could this be added to the documentation in a FAQ section?
> The function pointer is not a callback it is the function executed in
> the context and the void ptr is its argument.
> If you require to use boost.function you could easily create an object
> containing a boost::context and your boost:function instance. The
> context executes a trampoline function which will be invoked with the
> pointer to this object as argument. For more details look into boost.fiber.

Could you add an example using something else than a void(*)(void*) entry?


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