https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113143

--- Comment #10 from Ian Lance Taylor <ian at airs dot com> ---
The makecontext/getcontext/setcontext functions are called by libgo on
GNU/Linux for all targets other than x86_64.  It is not the case that they are
used only on *BSD systems.

The default gc implementation does not require these functions because it
provides assembler code.  This of course limits the gc implementation to only
support a limited number of targets: those for which the assembler code exists.
 libgo is intended to be more portable.

To be clear I am fine with removing or guarding references to ucontext.h where
that makes sense.  I'm just pointing out that the code can't in general work if
the *context functions are not available.  It's unfortunate that POSIX removed
them without providing adequate replacements.  Saying that they "can be
replaced using POSIX threads functions" is simply false.  They provide a
portable mechanism for a userspace threads mechanism on top of POSIX threads. 
Without them there is no way for libgo to implement goroutines efficiently.

Reply via email to