mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] move the definition of __pthread_tsd_main in the only compilation unit that references it
@ 2013-02-11  9:19 Jens Gustedt
  2013-02-11 10:24 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Gustedt @ 2013-02-11  9:19 UTC (permalink / raw)
  To: musl

This also avoids a const cast that doesn't seem to be very useful.

0	3	src/thread/pthread_key_create.c
4	4	src/thread/pthread_self.c

diff --git a/src/thread/pthread_key_create.c b/src/thread/pthread_key_create.c
index e51cb02..084cbaa 100644
--- a/src/thread/pthread_key_create.c
+++ b/src/thread/pthread_key_create.c
@@ -1,8 +1,5 @@
 #include "pthread_impl.h"
 
-const size_t __pthread_tsd_size = sizeof(void *) * PTHREAD_KEYS_MAX;
-void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };
-
 static void (*keys[PTHREAD_KEYS_MAX])(void *);
 
 static void nodtor(void *dummy)
diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c
index 23dbaa5..efb3f0c 100644
--- a/src/thread/pthread_self.c
+++ b/src/thread/pthread_self.c
@@ -2,9 +2,9 @@
 
 static struct pthread *main_thread = &(struct pthread){0};
 
-/* pthread_key_create.c overrides this */
-static const void *dummy[1] = { 0 };
-weak_alias(dummy, __pthread_tsd_main);
+static void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };
+/* unused? */
+const size_t __pthread_tsd_size = sizeof(__pthread_tsd_main);
 
 static int init_main_thread()
 {
@@ -12,7 +12,7 @@ static int init_main_thread()
 		SIGPT_SET, 0, __SYSCALL_SSLEN);
 	if (__set_thread_area(TP_ADJ(main_thread)) < 0) return -1;
 	main_thread->canceldisable = libc.canceldisable;
-	main_thread->tsd = (void **)__pthread_tsd_main;
+	main_thread->tsd = __pthread_tsd_main;
 	main_thread->errno_ptr = __errno_location();
 	main_thread->self = main_thread;
 	main_thread->tid = main_thread->pid =
-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] move the definition of __pthread_tsd_main in the only compilation unit that references it
  2013-02-11  9:19 [PATCH] move the definition of __pthread_tsd_main in the only compilation unit that references it Jens Gustedt
@ 2013-02-11 10:24 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2013-02-11 10:24 UTC (permalink / raw)
  To: musl

* Jens Gustedt <Jens.Gustedt@inria.fr> [2013-02-11 10:19:44 +0100]:
> This also avoids a const cast that doesn't seem to be very useful.
> 
> 0	3	src/thread/pthread_key_create.c
> 4	4	src/thread/pthread_self.c
> 
> diff --git a/src/thread/pthread_key_create.c b/src/thread/pthread_key_create.c
> index e51cb02..084cbaa 100644
> --- a/src/thread/pthread_key_create.c
> +++ b/src/thread/pthread_key_create.c
> @@ -1,8 +1,5 @@
>  #include "pthread_impl.h"
>  
> -const size_t __pthread_tsd_size = sizeof(void *) * PTHREAD_KEYS_MAX;
> -void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };
> -
>  static void (*keys[PTHREAD_KEYS_MAX])(void *);


__pthread_tsd_size was used in pthread_attr_setstack, so
we guarantee that the thread has at least that much stack
but recently the policy was changed around tls see

git log --patch src/thread/pthread_attr_setstack.c


so yes __pthread_tsd_size is not used anymore


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-11 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11  9:19 [PATCH] move the definition of __pthread_tsd_main in the only compilation unit that references it Jens Gustedt
2013-02-11 10:24 ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).