TODO revision 1.1.2.11 1 Bugs 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: sigaction() currently hard-codes __sigtramp_sigcontext_1:
11 this is incorrect. Instead of calling __sigaction_sigtramp() directly,
12 libc should export a __libc_sigaction14() which sigaction() can call.
13 Also, pthread_sig.c should probably be built with __LIBC12_SOURCE__ so
14 that the signal version of sigaction(), et al can be explicit.
15 - pthread_sig.c: pthread__signal_tramp() is broken. It gets a ucontext,
16 but then hands off an empty (garbage from stack!) sigcontext to the
17 handler. The ucontext MUST be converted to a sigcontext, the handler
18 called, and then the sigcontext converted back to ucontext, before the
19 ucontext is used to perform the sigreturn-analogue. This is necessary
20 for e.g. C++/Java exceptions and some garbage-collectors.
21 - pthread_sig.c: pthread__signal_tramp() should be changed so that it is
22 easy to add support for SA_SIGINFO later. (Mostly a function signature
23 issue.)
24 - Consider moving pthread__signal_tramp() to its own file, and building
25 it with -fasync-unwind-tables, so that DWARF2 EH unwinding works through
26 it. (This is required for e.g. GCC's libjava.)
27 - locks: Add support for RAS on uniprocessors.
28 - pthread_lock.c: pthread_spin_lock() should use a loop around
29 __cpu_simple_lock_try() so that it is easy to add support for RAS.
30
31
32 Interfaces/features to implement:
33 - pthread_kill()
34 - pthread_atfork()
35 - pthread_rwlock... These are currently stubbed to MUTEX in libc!!
36 - priority scheduling
37 - libc integration:
38 - foo_r interfaces
39 - system integration
40 - some macros and prototypes belong in headers other than pthread.h
41
42
43 Features that need more/better regression tests:
44 - pthread_cond_broadcast()
45 - pthread_once()
46 - pthread_get/setspecific()
47 - signals
48
49
50 Things that need fixing:
51 - Recycle dead threads for new threads.
52
53 Ideas to play with:
54 - Explore the trapcontext vs. usercontext distinction in ucontext_t.
55 - Get rid of thread structures when too many accumulate (is this
56 actually a good idea?)
57 - Adaptive spin/sleep locks for mutexes.
58 - Supporting different mutex types would be nice (normal, debugging,
59 recursive, etc).
60 - Currently, each thread uses two real pages of memory: one at the top
61 of the stack for actual stack data, and one at the bottom for the
62 pthread_st. If we can get suitable space above the initial stack for
63 main(), we can cut this to one page per thread. Perhaps crt0 should
64 do something different (give us more space) if libpthread is linked
65 in?
66 - Figure out whether/how to expose the inline version of
67 pthread_self().
68