This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: how to obtain pthread_suspend
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Joël Krähemann <weedlight at gmail dot com>
- Cc: libc-help at sourceware dot org
- Date: Fri, 13 Sep 2013 16:59:29 -0400
- Subject: Re: how to obtain pthread_suspend
- Authentication-results: sourceware.org; auth=none
- References: <1379106662 dot 542 dot 12 dot camel at debianWEED>
On 09/13/2013 05:11 PM, Joël Krähemann wrote:
> Hi
>
> I'm looking for pthread_suspend does it exist in glibc?
>
> I'm just building a linux from scratch and my last step was compiling
> glibc but can't find pthread_suspend and pthread_resume.
>
> For more details see:
> http://sourceforge.net/p/ags/code/HEAD/tree/src/ags/thread/ags_thread.c
>
> within function:
> ags_thread_real_timelock(AgsThread *thread)
The functions pthread_suspend and pthread_resume are
not part of POSIX and not provided by glibc's NPTL
POSIX threading implementation.
POSIX provides no way for you to suspend or resume
another thread without coordination from that thread.
The only way to do this easily is with signals.
Perhaps see if SIGSTOP and SIGCONT can be applied to
threads, if not try sending a signal to the target
thread and having it wait in the signal handler
until told to resume? Careful that you can only
run async-signal-safe operations in that handler.
I wouldn't be opposed to someone proposing adding
pthread_suspend_np and pthread_resume_np to glibc,
but it requires kernel work.
Cheers,
Carlos.