[PATCH 2/2] Add support for LinuxThreads.

Leonard Crestez lcrestez at ixiacom.com
Mon Oct 21 14:12:16 PDT 2013


When using LinuxThreads pthread_setspecific triggers recursive 
allocation on all threads. Work around this by creating a global linked 
list of in-progress tsd initializations.

This modifies the _tsd_get_wrapper macro-generated function. When it has
to initialize an TSD object it will push the item to the linked list
first. If this causes a recursive allocation then the _get_wrapper
request is satisfied from the list. When pthread_setspecific returns the 
item is removed from the list.

This effectively adds a very poor substitute for real TLS used only
during pthread_setspecific allocation recursion.

Signed-off-by: Crestez Dan Leonard <lcrestez at ixiacom.com>
---
   include/jemalloc/internal/tsd.h | 63 
+++++++++++++++++++++++++++++++++++++++++
   1 file changed, 63 insertions(+)



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-support-for-LinuxThreads.patch
Type: text/x-patch
Size: 3023 bytes
Desc: not available
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20131022/c22a5fd3/attachment.bin>


More information about the jemalloc-discuss mailing list