Boost logo

Boost :

Subject: Re: [boost] review request for boost.context
From: Holger Grund (holger.grund_at_[hidden])
Date: 2010-07-29 08:25:26


>> Oliver Kowalke<k-oli_at_[hidden]> writes:
>> All is now well, provided code on Fiber 1 doesn't use thread-local
>> variables. Recent versions of the MSVC runtime use fiber-local
>> variables instead of thread-local ones, so standard C and C++
>> functions should be OK,
>
>Hmm - maybe boost.context should take care of fiber data (fs:[0x10]) and
arbitary data slot (fs:[0x14])?!

I must admit I haven't been following all of this thread but I'm quite a bit
concerned by this approach. I worked on VC's CRT for over two years and I
can tell you that these things are much more involved (and from haunting a
shutdown bug I'm fairly certain there's another pointer fairly high up in
the TIB to the FLS data and/or rundown list). Unless there's documentation
that clearly states you can rely on binary layout and semantics of structure
members, you shouldn't.

Besides execution context is not something considered stable within the
operating system itself as there are architectural advancements (AVX
register state is a recent example that was up for a change in Windows 7 and
again in W7 SP1 -- and VC10 does generate instructions accessing YMM
registers even without intrinsics in user code).

Again, I haven't looked at code (yet?) and I'm no longer with MSFT and can't
just look up the bits, but trying to outsmart the OS facilities is almost
certainly a bad idea.

-hg


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