This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: how to obtain pthread_suspend
- From: Joël Krähemann <weedlight at gmail dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: libc-help at sourceware dot org
- Date: Sat, 14 Sep 2013 11:55:16 +0000
- Subject: Re: how to obtain pthread_suspend
- Authentication-results: sourceware.org; auth=none
- References: <1379106662 dot 542 dot 12 dot camel at debianWEED> <52337CB1 dot 9010806 at redhat dot com>
Am Freitag, den 13.09.2013, 16:59 -0400 schrieb Carlos O'Donell:
> 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.
I'll do a work-around but as long I can't suspend/resume the GUI loop,
it will block AgsTaskThread. I think that async-signal operations need a
point where it is synced else it won't be safe or you are doing some
ugly mutices scattered all along the code.
regards
JoÃl