how to obtain pthread_suspend
Carlos O'Donell
carlos@redhat.com
Fri Sep 13 20:59:00 GMT 2013
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.
More information about the Libc-help
mailing list