xref: /netbsd-src/lib/libpthread/TODO (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
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__kill_self() passes a bogus ucontext to the handler.
12  This is probably not very important.
13- pthread_sig.c: Come up with a signal trampoline naming convention like
14  libc's, so that GDB will have an easier time with things.
15- Consider moving pthread__signal_tramp() to its own file, and building
16  it with -fasync-unwind-tables, so that DWARF2 EH unwinding works through
17  it.  (This is required for e.g. GCC's libjava.)
18- Add locking to ld.elf_so so that multiple threads doing lazy binding
19  doesn't trash things.
20- Verify the cancel stub symbol trickery.
21
22
23Interfaces/features to implement:
24- pthread_atfork()
25- priority scheduling
26- libc integration:
27   - foo_r interfaces
28- system integration
29   - some macros and prototypes belong in headers other than pthread.h
30
31
32Features that need more/better regression tests:
33 - pthread_cond_broadcast()
34 - pthread_once()
35 - pthread_get/setspecific()
36 - signals
37
38
39Things that need fixing:
40- Recycle dead threads for new threads.
41
42Ideas to play with:
43- Explore the trapcontext vs. usercontext distinction in ucontext_t.
44- Get rid of thread structures when too many accumulate (is this
45  actually a good idea?)
46- Adaptive spin/sleep locks for mutexes.
47- Currently, each thread uses two real pages of memory: one at the top
48  of the stack for actual stack data, and one at the bottom for the
49  pthread_st. If we can get suitable space above the initial stack for
50  main(), we can cut this to one page per thread. Perhaps crt0 should
51  do something different (give us more space) if libpthread is linked
52  in?
53- Figure out whether/how to expose the inline version of
54  pthread_self().
55- Along the same lines, figure out whether/how to use registers reserved
56  in the ABI for thread-specific-data to implement pthread_self().
57- Figure out what to do with changing stack sizes.
58