xref: /netbsd-src/lib/libpthread/TODO (revision c62a74e6d5cfb2fb5034e98b983da7e2fc87709d)
1Bugs to fix:
2
3- pthread_cond_timedwait() doesn't work if SA's aren't running yet,
4  because the alarm system isn't up and running. It would be weird to
5  use them that way, but it's perfectly legal.
6- There is a race between pthread_cancel() and
7  pthread_cond_broadcast() or pthread_exit() about removing an item
8  from the sleep queue. The locking protocols there need a little
9  adjustment.
10- pthread_sig.c: pthread__signal_tramp() is broken.  It gets a ucontext,
11  but then hands off an empty (garbage from stack!) sigcontext to the
12  handler.  The ucontext MUST be converted to a sigcontext, the handler
13  called, and then the sigcontext converted back to ucontext, before the
14  ucontext is used to perform the sigreturn-analogue.  This is necessary
15  for e.g. C++/Java exceptions and some garbage-collectors.
16- pthread_sig.c: pthread__signal_tramp() should be changed so that it is
17  easy to add support for SA_SIGINFO later.  (Mostly a function signature
18  issue.)
19- pthread_sig.c: Come up with a signal trampoline naming convention like
20  libc's, so that GDB will have an easier time with things.
21- Consider moving pthread__signal_tramp() to its own file, and building
22  it with -fasync-unwind-tables, so that DWARF2 EH unwinding works through
23  it.  (This is required for e.g. GCC's libjava.)
24- Add locking to ld.elf_so so that multiple threads doing lazy binding
25  doesn't trash things.
26- Verify the cancel stub symbol trickery.
27
28
29Interfaces/features to implement:
30- pthread_kill()
31- pthread_atfork()
32- priority scheduling
33- libc integration:
34   - foo_r interfaces
35- system integration
36   - some macros and prototypes belong in headers other than pthread.h
37
38
39Features that need more/better regression tests:
40 - pthread_cond_broadcast()
41 - pthread_once()
42 - pthread_get/setspecific()
43 - signals
44
45
46Things that need fixing:
47- Recycle dead threads for new threads.
48
49Ideas to play with:
50- Explore the trapcontext vs. usercontext distinction in ucontext_t.
51- Get rid of thread structures when too many accumulate (is this
52  actually a good idea?)
53- Adaptive spin/sleep locks for mutexes.
54- Currently, each thread uses two real pages of memory: one at the top
55  of the stack for actual stack data, and one at the bottom for the
56  pthread_st. If we can get suitable space above the initial stack for
57  main(), we can cut this to one page per thread. Perhaps crt0 should
58  do something different (give us more space) if libpthread is linked
59  in?
60- Figure out whether/how to expose the inline version of
61  pthread_self().
62- Along the same lines, figure out whether/how to use registers reserved
63  in the ABI for thread-specific-data to implement pthread_self().
64