TODO revision 1.4
11.2SthorpejBugs to fix:
21.2Sthorpej
31.3Sjdolecek- some blocking routines (like sem_wait()) don't work if SA's aren't
41.3Sjdolecek  running yet, because the alarm system isn't up and running or there is no
51.3Sjdolecek  thread context to switch to. It would be weird to use them that
61.3Sjdolecek  way, but it's perfectly legal.
71.2Sthorpej- There is a race between pthread_cancel() and
81.2Sthorpej  pthread_cond_broadcast() or pthread_exit() about removing an item
91.2Sthorpej  from the sleep queue. The locking protocols there need a little
101.2Sthorpej  adjustment.
111.4Schristos- pthread_sig.c: pthread__kill_self() passes a bogus ucontext to the handler.
121.4Schristos  This is probably not very important.
131.2Sthorpej- pthread_sig.c: Come up with a signal trampoline naming convention like
141.2Sthorpej  libc's, so that GDB will have an easier time with things.
151.2Sthorpej- Consider moving pthread__signal_tramp() to its own file, and building
161.2Sthorpej  it with -fasync-unwind-tables, so that DWARF2 EH unwinding works through
171.2Sthorpej  it.  (This is required for e.g. GCC's libjava.)
181.2Sthorpej- Add locking to ld.elf_so so that multiple threads doing lazy binding
191.2Sthorpej  doesn't trash things.
201.2Sthorpej- Verify the cancel stub symbol trickery.
211.2Sthorpej
221.2Sthorpej
231.2SthorpejInterfaces/features to implement:
241.2Sthorpej- pthread_atfork()
251.2Sthorpej- priority scheduling
261.2Sthorpej- libc integration: 
271.2Sthorpej   - foo_r interfaces
281.2Sthorpej- system integration
291.2Sthorpej   - some macros and prototypes belong in headers other than pthread.h
301.2Sthorpej
311.2Sthorpej
321.2SthorpejFeatures that need more/better regression tests:
331.2Sthorpej - pthread_cond_broadcast()
341.2Sthorpej - pthread_once()
351.2Sthorpej - pthread_get/setspecific()
361.2Sthorpej - signals
371.2Sthorpej
381.2Sthorpej
391.2SthorpejThings that need fixing:
401.2Sthorpej- Recycle dead threads for new threads.
411.2Sthorpej
421.2SthorpejIdeas to play with:
431.2Sthorpej- Explore the trapcontext vs. usercontext distinction in ucontext_t.
441.2Sthorpej- Get rid of thread structures when too many accumulate (is this
451.2Sthorpej  actually a good idea?)
461.2Sthorpej- Adaptive spin/sleep locks for mutexes.
471.2Sthorpej- Currently, each thread uses two real pages of memory: one at the top
481.2Sthorpej  of the stack for actual stack data, and one at the bottom for the
491.2Sthorpej  pthread_st. If we can get suitable space above the initial stack for
501.2Sthorpej  main(), we can cut this to one page per thread. Perhaps crt0 should
511.2Sthorpej  do something different (give us more space) if libpthread is linked
521.2Sthorpej  in?
531.2Sthorpej- Figure out whether/how to expose the inline version of
541.2Sthorpej  pthread_self().
551.2Sthorpej- Along the same lines, figure out whether/how to use registers reserved
561.2Sthorpej  in the ABI for thread-specific-data to implement pthread_self().
571.4Schristos- Figure out what to do with changing stack sizes.
58