From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Use THREAD_*_PRIVATE_FUTEX macros
Date: Thu, 24 May 2007 21:19:00 -0000 [thread overview]
Message-ID: <20070524212049.GH3081@sunsite.mff.cuni.cz> (raw)
Hi!
This will be needed for ppc* as well, as private_futex will
live outside of struct pthread there.
In addition to this it allows all other arches to compile for the time
being (well, when I port gscope_flag to them) and private futex support
can be added there incrementally.
2007-04-24 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/tls.h (THREAD_SET_PRIVATE_FUTEX,
THREAD_COPY_PRIVATE_FUTEX): Define.
* sysdeps/x86_64/tls.h (THREAD_SET_PRIVATE_FUTEX,
THREAD_COPY_PRIVATE_FUTEX): Define.
* allocatestack.c (allocate_stack): Use THREAD_COPY_PRIVATE_FUTEX.
* init.c (__pthread_initialize_minimal_internal): Use
THREAD_SET_PRIVATE_FUTEX.
--- libc/nptl/sysdeps/i386/tls.h.jj 2007-05-24 17:53:37.000000000 +0200
+++ libc/nptl/sysdeps/i386/tls.h 2007-05-24 18:39:15.000000000 +0200
@@ -459,6 +459,15 @@ union user_desc_init
GL(dl_wait_lookup_done) ()
+#ifndef __ASSUME_PRIVATE_FUTEX
+# define THREAD_SET_PRIVATE_FUTEX(value) \
+ THREAD_SETMEM (THREAD_SELF, header.private_futex, value)
+# define THREAD_COPY_PRIVATE_FUTEX(descr) \
+ ((descr)->header.private_futex \
+ = THREAD_GETMEM (THREAD_SELF, header.private_futex))
+#endif
+
+
#endif /* __ASSEMBLER__ */
#endif /* tls.h */
--- libc/nptl/sysdeps/x86_64/tls.h.jj 2007-05-24 17:53:58.000000000 +0200
+++ libc/nptl/sysdeps/x86_64/tls.h 2007-05-24 18:38:48.000000000 +0200
@@ -364,6 +364,13 @@ typedef struct
#define THREAD_GSCOPE_WAIT() \
GL(dl_wait_lookup_done) ()
+#ifndef __ASSUME_PRIVATE_FUTEX
+# define THREAD_SET_PRIVATE_FUTEX(value) \
+ THREAD_SETMEM (THREAD_SELF, header.private_futex, value)
+# define THREAD_COPY_PRIVATE_FUTEX(descr) \
+ ((descr)->header.private_futex \
+ = THREAD_GETMEM (THREAD_SELF, header.private_futex))
+#endif
#endif /* __ASSEMBLER__ */
--- libc/nptl/allocatestack.c.jj 2007-05-24 18:01:04.000000000 +0200
+++ libc/nptl/allocatestack.c 2007-05-24 18:36:45.000000000 +0200
@@ -376,10 +376,9 @@ allocate_stack (const struct pthread_att
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
#endif
-#ifndef __ASSUME_PRIVATE_FUTEX
+#ifdef THREAD_COPY_PRIVATE_FUTEX
/* The thread must know when private futexes are supported. */
- pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
- header.private_futex);
+ THREAD_COPY_PRIVATE_FUTEX (pd);
#endif
#ifdef NEED_DL_SYSINFO
@@ -516,10 +515,9 @@ allocate_stack (const struct pthread_att
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
#endif
-#ifndef __ASSUME_PRIVATE_FUTEX
+#ifdef THREAD_COPY_PRIVATE_FUTEX
/* The thread must know when private futexes are supported. */
- pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
- header.private_futex);
+ THREAD_COPY_PRIVATE_FUTEX (pd);
#endif
#ifdef NEED_DL_SYSINFO
--- libc/nptl/init.c.jj 2007-05-24 16:41:06.000000000 +0200
+++ libc/nptl/init.c 2007-05-24 18:42:53.000000000 +0200
@@ -276,7 +276,7 @@ __pthread_initialize_minimal_internal (v
#endif
set_robust_list_not_avail ();
-#ifndef __ASSUME_PRIVATE_FUTEX
+#ifdef THREAD_SET_PRIVATE_FUTEX
/* Private futexes are always used (at least internally) so that
doing the test once this early is beneficial. */
{
@@ -284,7 +284,7 @@ __pthread_initialize_minimal_internal (v
res = INTERNAL_SYSCALL (futex, err, 3, &word,
FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
if (!INTERNAL_SYSCALL_ERROR_P (res, err))
- THREAD_SETMEM (pd, header.private_futex, FUTEX_PRIVATE_FLAG);
+ THREAD_SET_PRIVATE_FUTEX (pd, FUTEX_PRIVATE_FLAG);
}
#endif
Jakub
reply other threads:[~2007-05-24 21:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070524212049.GH3081@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).