public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] RTEMS: Optimize pthread_once_t
@ 2017-10-05 12:56 Sebastian Huber
0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2017-10-05 12:56 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4fef7312b31bed6c77add331805f5212551c54cd
commit 4fef7312b31bed6c77add331805f5212551c54cd
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Tue Sep 19 15:08:35 2017 +0200
RTEMS: Optimize pthread_once_t
Reduce size of pthread_once_t and make it zero-initialized.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Diff:
---
newlib/libc/sys/rtems/include/machine/_threads.h | 5 ++---
newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 8 ++++----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/newlib/libc/sys/rtems/include/machine/_threads.h b/newlib/libc/sys/rtems/include/machine/_threads.h
index 24db21c..5faa78f 100644
--- a/newlib/libc/sys/rtems/include/machine/_threads.h
+++ b/newlib/libc/sys/rtems/include/machine/_threads.h
@@ -41,12 +41,11 @@ typedef __uint32_t tss_t;
/* pthread_once_t */
typedef struct {
- int _is_initialized;
- int _init_executed;
+ unsigned char _flags;
} once_flag;
/* PTHREAD_ONCE_INIT */
-#define ONCE_FLAG_INIT { 1, 0 }
+#define ONCE_FLAG_INIT { 0 }
/* PTHREAD_DESTRUCTOR_ITERATIONS */
#define TSS_DTOR_ITERATIONS 4
diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
index bd66c68..9db50fe 100644
--- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
+++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
@@ -169,11 +169,11 @@ typedef struct {
typedef __uint32_t pthread_key_t; /* thread-specific data keys */
typedef struct {
- int is_initialized; /* is this structure initialized? */
- int init_executed; /* has the initialization routine been run? */
-} pthread_once_t; /* dynamic package initialization */
+ unsigned char _flags;
+} pthread_once_t;
+
+#define _PTHREAD_ONCE_INIT { 0 }
-#define _PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */
#endif /* defined(_POSIX_THREADS) */
/* POSIX Barrier Types */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-10-05 12:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 12:56 [newlib-cygwin] RTEMS: Optimize pthread_once_t Sebastian Huber
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).