|
Boost Users : |
Subject: Re: [Boost-users] [coroutine] Stack corruption?
From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2009-08-06 02:12:54
On Thu, Aug 06, 2009 at 09:25:56AM +0400, Pavel Shevaev wrote:
>
> I migrated to boost.fibers for now and increased the size of the
> default stack to 64kb and corruption was gone. I tried to increase the
> amount of stack size for boost.coroutine as well but for some reason
> it didn't work. I'm going to find out what was wrong with
> boost.coroutine since it's faster than boost.fibers thanks to lighter
> implementation of stack switching.
>
I would advise against using hand-coded context switch under windows, unless
you have *really* good knowledge of the internals of Windows' process model.
Windows' process model is more complex than POSIX and proper context switch, as
performed by the Fiber API, does few more things than just swapping the values
of few registers. Using the Fibers API is safe(r) and CPU-independent.
Anyway, if you're using visual studio, be sure to tell optimizer that you're
using fibers (there's an option somewhere in project properties that forces
the optimizer to use only fiber-safe optimizations).
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net