Boost logo

Boost :

Subject: Re: [boost] review request for boost.context
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-07-28 15:09:48


> Am 28.07.2010 19:21, schrieb Hartmut Kaiser:
> >> The TIB is not changed (only the pointers pointing to the limit and
> >> base of the stack).
> >
> > That will result in problems, I'm sure - at least as soon as you start
> > moving context's between threads.
>
> Hmm - boost.fiber uses boost.context and has some tests moving the boost
> fibers between boost threads.
> I didn't get errors until now =:o

I'm not much of an expert of Windows internals. So it might be that our
assembly context switch implementation was flawed.

> Could you describe a scenario which will trigger an error, please?

We had problems during initialization of the runtime libraries under Win64,
debug mode. That's all what I remember.

> >> AFAIK migrating Win32 Fibers between threads is not possible and
> >> cloning also not - but maybe I'm wrong in this point.
> >
> > Moving Windows fibers between threads is definitely possible.
>
> Isn't the TIB accessible over fs register? At least SEH handler is
> accessed via fs:[0] and the structure of TIB can be accessed from fs:[0].
> Wouldn't be the content of fs:[0] another if I move a Win32 fiber to
> another thread (pointing to another TIB -> see stakc base and limit in
> TIB)? Or do I have to use a special function form the Win32 API?

That's what SwitchFiber is taking care of, I guess. AFAIR it manipulates the
content of fs:[0] as well.
FWIW, we have a quite complex system running which definitely moves Win32
fibers between threads. And it works without problems.

Regards Hartmut

---------------
Meet me at BoostCon
www.boostcon.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk