This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

No way to cleanup at thread exit for __thread variables?


I'm considering converting an application that uses pthread_key_XXX
methods for thread local storage over to using GCC's native support (the
__thread attribute), since it should be significantly more efficient.

However, I find myself at a loss to figure how this is intended to be
used for dynamically sized variables... for example, what if I wanted to
have each thread have a separate linked list of items it was supposed to
process? There does not appear to be any way to clean these entries up
at thread exit time, whereas pthread_key_create gives me the option of
providing a cleanup function.

pthread_cleanup_push() and _pop() are really not appropriate for this,
as they are designed to be used within a single function's scope of
execution.

Am I missing something here? Is gcc's __thread support really only
usable for variables that are not (or don't contain) pointers to
dynamically allocated storage?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]