NetBSD/lib/libpthread/TODO

64 lines
2.6 KiB
Plaintext

Bugs to fix:
- pthread_cond_timedwait() doesn't work if SA's aren't running yet,
because the alarm system isn't up and running. It would be weird to
use them that way, but it's perfectly legal.
- There is a race between pthread_cancel() and
pthread_cond_broadcast() or pthread_exit() about removing an item
from the sleep queue. The locking protocols there need a little
adjustment.
- pthread_sig.c: pthread__signal_tramp() is broken. It gets a ucontext,
but then hands off an empty (garbage from stack!) sigcontext to the
handler. The ucontext MUST be converted to a sigcontext, the handler
called, and then the sigcontext converted back to ucontext, before the
ucontext is used to perform the sigreturn-analogue. This is necessary
for e.g. C++/Java exceptions and some garbage-collectors.
- pthread_sig.c: pthread__signal_tramp() should be changed so that it is
easy to add support for SA_SIGINFO later. (Mostly a function signature
issue.)
- pthread_sig.c: Come up with a signal trampoline naming convention like
libc's, so that GDB will have an easier time with things.
- Consider moving pthread__signal_tramp() to its own file, and building
it with -fasync-unwind-tables, so that DWARF2 EH unwinding works through
it. (This is required for e.g. GCC's libjava.)
- Add locking to ld.elf_so so that multiple threads doing lazy binding
doesn't trash things.
- Verify the cancel stub symbol trickery.
Interfaces/features to implement:
- pthread_kill()
- pthread_atfork()
- priority scheduling
- libc integration:
- foo_r interfaces
- system integration
- some macros and prototypes belong in headers other than pthread.h
Features that need more/better regression tests:
- pthread_cond_broadcast()
- pthread_once()
- pthread_get/setspecific()
- signals
Things that need fixing:
- Recycle dead threads for new threads.
Ideas to play with:
- Explore the trapcontext vs. usercontext distinction in ucontext_t.
- Get rid of thread structures when too many accumulate (is this
actually a good idea?)
- Adaptive spin/sleep locks for mutexes.
- Currently, each thread uses two real pages of memory: one at the top
of the stack for actual stack data, and one at the bottom for the
pthread_st. If we can get suitable space above the initial stack for
main(), we can cut this to one page per thread. Perhaps crt0 should
do something different (give us more space) if libpthread is linked
in?
- Figure out whether/how to expose the inline version of
pthread_self().
- Along the same lines, figure out whether/how to use registers reserved
in the ABI for thread-specific-data to implement pthread_self().