This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: swapcontext() slow
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-help at sourceware dot org
- Date: Thu, 21 Jan 2016 18:08:52 -0200
- Subject: Re: swapcontext() slow
- Authentication-results: sourceware.org; auth=none
- References: <56A0D8BA dot 6020605 at list dot ru> <20160121164016 dot GH14840 at vapier dot lan> <CAB4+JYKbmhvg0og7FqBi8wL5pDryyRrm1Ap80CNx5=4YwctqDA at mail dot gmail dot com> <20160121174757 dot GN14840 at vapier dot lan> <CAB4+JYJPyw0sKO8a06YkD8mTygkTEKxOKPyZh3HtJDDPWykf7g at mail dot gmail dot com>
On 21-01-2016 15:53, Godmar Back wrote:
> On Thu, Jan 21, 2016 at 12:47 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On 21 Jan 2016 12:24, Godmar Back wrote:
>>> On Thu, Jan 21, 2016 at 11:40 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>>>> these functions are deprecated/dead -- they no longer exist in the latest
>>>> POSIX specification. the preference would be to stop using them. i think
>>>> we might consider dropping them in a future glibc version.
>>>
>>> Interesting - what's replacing them, if anything?
>>>
>>> Will there be any support infrastructure for portable user-level threading?
>>
>> use pthreads. there are usually implementations for whatever OS you
>> want. at least more portable than the context functions.
>
> Pthreads does not provide user-level threading to my knowledge.
> Over a decade ago, Linux rejected NGPT in favor of NPTL, and to my
> knowledge even Solaris dropped M:N threading several years ago.
> Languages such as golang usually roll their own.
>
> - Godmar
>
If you intend to implement something like the coroutines in boost or go
you will end up need to craft some arch-specific code to handle the context
save/restore based on the ABI you will use. This is what boost context
does [1].
[1] https://github.com/boostorg/context/tree/develop/src/asm