Fibers and cygtls

David McFarland corngood@gmail.com
Sat Sep 5 02:46:16 GMT 2020


> Bottom line is, before trying to use Windows fibers, or before letting
> boost use Windows functions on Cygwin (sigh), check what other POSIX or
> BSD systems provide to implement coroutines.  If there's an API, let's
> implement this API in Cygwin and then use that from user space.

boost-context doesn't actually use Windows fibers by default. Its fiber
implementation (fcontext) uses user-provided buffers for fiber stacks.

The jump implementation is in:

https://github.com/boostorg/context/blob/develop/src/asm/jump_x86_64_ms_pe_gas.asm

On Linux I believe uses its own asm implementation without any kernel
interaction:

https://github.com/boostorg/context/blob/develop/src/asm/jump_x86_64_sysv_elf_gas.S

There's also an implementation (ucontext) using makecontext, which may
be the best option. I'll try that next.

The implementations are compared here:

https://www.boost.org/doc/libs/1_74_0/libs/context/doc/html/context/cc/implementations__fcontext_t__ucontext_t_and_winfiber.html


More information about the Cygwin-developers mailing list