This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Go patch committed: Multiplex goroutines onto OS threads


On 11/28/2011 06:46 AM, Ian Lance Taylor wrote:
This implementation relies on the functions getcontext, setcontext, and
makecontext.  If there are systems which don't have those, getcontext
and setcontext can be replaced by setjmp and longjmp, but there is no
obvious replacement for makecontext.  I think that will have to be
implemented using processor-specific code, as it needs to set the stack
pointer to point to a new stack, and I don't know how to do that in a
portable processor-independent manner without using makecontext.

ARM glibc does not implement these functions, so we have the same problem in QEMU. (On top of this, there is no way that alternate stacks can work on OpenBSD, so we still have one coroutine per thread).


For QEMU, I tried replacing for makecontext using sigaltstack. It works on Linux but it needs a dedicated signal, so it is likely inappropriate for libgo. It would also need to be tested across many operating systems because it may trigger subtleties in other OSes.

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]