path: root/src/internal/pthread_impl.h
diff options
authorRich Felker <>2014-06-10 04:49:49 -0400
committerRich Felker <>2014-06-10 04:49:49 -0400
commitac31bf278d9ed855e6765bb71d64ed19d2b7c0f8 (patch)
tree7bb84ee108a4ce18d69164e3bd28ca5f586f9d30 /src/internal/pthread_impl.h
parentdf15168cf8baf34fb9c94e19eaa1a5c79c853970 (diff)
simplify errno implementation
the motivation for the errno_ptr field in the thread structure, which this commit removes, was to allow the main thread's errno to keep its address when lazy thread pointer initialization was used. &errno was evaluated prior to setting up the thread pointer and stored in errno_ptr for the main thread; subsequently created threads would have errno_ptr pointing to their own errno_val in the thread structure. since lazy initialization was removed, there is no need for this extra level of indirection; __errno_location can simply return the address of the thread's errno_val directly. this does cause &errno to change, but the change happens before entry to application code, and thus is not observable.
Diffstat (limited to 'src/internal/pthread_impl.h')
1 files changed, 1 insertions, 1 deletions
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
index 2e910b3e..650e8115 100644
--- a/src/internal/pthread_impl.h
+++ b/src/internal/pthread_impl.h
@@ -18,7 +18,7 @@ struct pthread {
uintptr_t sysinfo;
uintptr_t canary;
pid_t tid, pid;
- int tsd_used, errno_val, *errno_ptr;
+ int tsd_used, errno_val;
volatile int cancel, canceldisable, cancelasync;
int detached;
unsigned char *map_base;