[Swan] thread-local storage vs. thread-specific data

D. Hugh Redelmeier hugh at mimosa.com
Sun Oct 6 18:40:29 EEST 2013


xauth.c has a really complicated and badly written mechanism for keeping a 
per-thread sigjmp_buf.

This would be greatly simplified and made more conventional by using 
either thread-local storage vs. thread-specific data.

Which of these should we use?

thread-specific data:
- a standard part of POSIX
- awkward (confusing, complicated)

thread-local storage
- simple and clean to use
- part of C11
- implemented in GCC
  <http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Thread-Local.html#Thread-Local>

I would like to use thread-local storage, but fear that it might not
be supported on all our target platforms.

The platforms most likely to not have it are embedded.  Do they use
xauth.c?

Any thoughts?


More information about the Swan mailing list