This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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: how to obtain pthread_suspend


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.


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