The problem with __pthread_manager_adjust_prio
Ulrich Drepper
drepper@redhat.com
Mon Apr 15 14:15:00 GMT 2002
On Mon, 2002-04-15 at 13:35, H . J . Lu wrote:
> 1. pthread_start_thread needs to know the manager's priority when clone
> is called. There is no way to tell what the value will be since it can
> be changed at any time by __pthread_manager_adjust_prio. One way to
> solve it is not to check manager->p_priority in pthread_start_thread
> at all and always set SCHED_OTHER by default.
> 2. There is a race conditon between __pthread_manager_adjust_prio
> since diffetent threads can call it at any time.
There are many different ways to handle this and yes, thread-local
variables are needed.
In adjust_prio you set a flag before calling the syscall. After the
syscall you update the p_priority element and then you clear the flag.
When starting a new thread and the flag is not set communicate the new
priority in a thread-local variable to the new thread. If the flag is
set communicate this information and have the new thread unconditionally
set the scheduler and priority.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20020415/db2e5583/attachment.sig>
More information about the Libc-alpha
mailing list