xref: /netbsd-src/lib/libpthread/TODO (revision 001c68bd94f75ce9270b69227c4199fbf34ee396)
1Bugs to fix:
2
3- some blocking routines (like sem_wait()) don't work if SA's aren't
4  running yet, because the alarm system isn't up and running or there is no
5  thread context to switch to. It would be weird to use them that
6  way, but it's perfectly legal.
7- There is a race between pthread_cancel() and
8  pthread_cond_broadcast() or pthread_exit() about removing an item
9  from the sleep queue. The locking protocols there need a little
10  adjustment.
11- pthread_sig.c: pthread__signal_tramp() is broken.  It gets a ucontext,
12  but then hands off an empty (garbage from stack!) sigcontext to the
13  handler.  The ucontext MUST be converted to a sigcontext, the handler
14  called, and then the sigcontext converted back to ucontext, before the
15  ucontext is used to perform the sigreturn-analogue.  This is necessary
16  for e.g. C++/Java exceptions and some garbage-collectors.
17- pthread_sig.c: pthread__signal_tramp() should be changed so that it is
18  easy to add support for SA_SIGINFO later.  (Mostly a function signature
19  issue.)
20- pthread_sig.c: Come up with a signal trampoline naming convention like
21  libc's, so that GDB will have an easier time with things.
22- Consider moving pthread__signal_tramp() to its own file, and building
23  it with -fasync-unwind-tables, so that DWARF2 EH unwinding works through
24  it.  (This is required for e.g. GCC's libjava.)
25- Add locking to ld.elf_so so that multiple threads doing lazy binding
26  doesn't trash things.
27- Verify the cancel stub symbol trickery.
28
29
30Interfaces/features to implement:
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