* [PATCH 2/6] RTEMS: Make sem_t self-contained
2017-10-05 12:56 [PATCH 1/6] RTEMS: Optimize pthread_once_t Sebastian Huber
@ 2017-10-05 12:56 ` Sebastian Huber
2017-10-05 12:56 ` [PATCH 4/6] RTEMS: Make pthread_rwlock_t self-contained Sebastian Huber
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Huber @ 2017-10-05 12:56 UTC (permalink / raw)
To: newlib
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/sys/rtems/include/semaphore.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/sys/rtems/include/semaphore.h b/newlib/libc/sys/rtems/include/semaphore.h
index e3c61da04..44ecc58f4 100644
--- a/newlib/libc/sys/rtems/include/semaphore.h
+++ b/newlib/libc/sys/rtems/include/semaphore.h
@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/include/semaphore.h 314424 2017-02-28 21:47:00Z vangyzen $
*/
/* semaphore.h: POSIX 1003.1b semaphores */
@@ -33,10 +33,14 @@
#define _SEMAPHORE_H_
#include <sys/cdefs.h>
+#include <sys/lock.h>
#include <sys/_types.h>
#include <sys/_timespec.h>
-typedef __uint32_t sem_t;
+typedef struct {
+ unsigned long _flags;
+ struct _Semaphore_Control _Semaphore;
+} sem_t;
#define SEM_FAILED ((sem_t *)0)
--
2.12.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/6] RTEMS: Make pthread_rwlock_t self-contained
2017-10-05 12:56 [PATCH 1/6] RTEMS: Optimize pthread_once_t Sebastian Huber
2017-10-05 12:56 ` [PATCH 2/6] RTEMS: Make sem_t self-contained Sebastian Huber
@ 2017-10-05 12:56 ` Sebastian Huber
2017-10-05 12:56 ` [PATCH 6/6] RTEMS: Make pthread_mutex_t self-contained Sebastian Huber
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Huber @ 2017-10-05 12:56 UTC (permalink / raw)
To: newlib
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
index 4cb15d14b..5638f1569 100644
--- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
+++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
@@ -206,9 +206,14 @@ typedef struct {
/* POSIX Reader/Writer Lock Types */
#if defined(_POSIX_READER_WRITER_LOCKS)
-typedef __uint32_t pthread_rwlock_t; /* POSIX RWLock Object */
+typedef struct {
+ unsigned long _flags;
+ struct _Thread_queue_Queue _Queue;
+ unsigned int _current_state;
+ unsigned int _number_of_readers;
+} pthread_rwlock_t;
-#define _PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0xFFFFFFFF)
+#define _PTHREAD_RWLOCK_INITIALIZER { 0, _THREAD_QUEUE_INITIALIZER, 0, 0 }
typedef struct {
int is_initialized; /* is this structure initialized? */
--
2.12.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 6/6] RTEMS: Make pthread_mutex_t self-contained
2017-10-05 12:56 [PATCH 1/6] RTEMS: Optimize pthread_once_t Sebastian Huber
2017-10-05 12:56 ` [PATCH 2/6] RTEMS: Make sem_t self-contained Sebastian Huber
2017-10-05 12:56 ` [PATCH 4/6] RTEMS: Make pthread_rwlock_t self-contained Sebastian Huber
@ 2017-10-05 12:56 ` Sebastian Huber
2017-10-05 12:56 ` [PATCH 5/6] RTEMS: Make pthread_cond_t self-contained Sebastian Huber
2017-10-05 13:53 ` [PATCH 3/6] RTEMS: Make pthread_barrier_t self-contained Sebastian Huber
4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Huber @ 2017-10-05 12:56 UTC (permalink / raw)
To: newlib
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 30 +++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
index 0b607f7f2..b091ebbaf 100644
--- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
+++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
@@ -131,9 +131,35 @@ typedef struct {
#endif /* !defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) */
-typedef __uint32_t pthread_mutex_t; /* identify a mutex */
+struct _Chain_Node {
+ struct _Chain_Node *_next;
+ struct _Chain_Node *_previous;
+};
+
+struct _RBTree_Node {
+ struct _RBTree_Node *_left;
+ struct _RBTree_Node *_right;
+ struct _RBTree_Node *_parent;
+ int _color;
+};
+
+struct _Priority_Node {
+ union {
+ struct _RBTree_Node _RBTree;
+ struct _Chain_Node _Chain;
+ } _Node;
+ __uint64_t _priority;
+};
-#define _PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
+typedef struct {
+ unsigned long _flags;
+ struct _Mutex_recursive_Control _Recursive;
+ struct _Priority_Node _Priority_ceiling;
+ const struct _Scheduler_Control *_scheduler;
+} pthread_mutex_t;
+
+#define _PTHREAD_MUTEX_INITIALIZER \
+ { 0, _MUTEX_RECURSIVE_INITIALIZER, { { 0, 0, 0, 0 }, 0 }, 0 }
typedef struct {
int is_initialized;
--
2.12.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 5/6] RTEMS: Make pthread_cond_t self-contained
2017-10-05 12:56 [PATCH 1/6] RTEMS: Optimize pthread_once_t Sebastian Huber
` (2 preceding siblings ...)
2017-10-05 12:56 ` [PATCH 6/6] RTEMS: Make pthread_mutex_t self-contained Sebastian Huber
@ 2017-10-05 12:56 ` Sebastian Huber
2017-10-05 13:53 ` [PATCH 3/6] RTEMS: Make pthread_barrier_t self-contained Sebastian Huber
4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Huber @ 2017-10-05 12:56 UTC (permalink / raw)
To: newlib
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
index 5638f1569..0b607f7f2 100644
--- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
+++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
@@ -152,9 +152,13 @@ typedef struct {
/* Condition Variables */
-typedef __uint32_t pthread_cond_t; /* identify a condition variable */
+typedef struct {
+ unsigned long _flags;
+ struct _Thread_queue_Queue _Queue;
+ pthread_mutex_t *_mutex;
+} pthread_cond_t;
-#define _PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0xFFFFFFFF)
+#define _PTHREAD_COND_INITIALIZER { 0, _THREAD_QUEUE_INITIALIZER, 0 }
typedef struct {
int is_initialized;
--
2.12.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/6] RTEMS: Make pthread_barrier_t self-contained
2017-10-05 12:56 [PATCH 1/6] RTEMS: Optimize pthread_once_t Sebastian Huber
` (3 preceding siblings ...)
2017-10-05 12:56 ` [PATCH 5/6] RTEMS: Make pthread_cond_t self-contained Sebastian Huber
@ 2017-10-05 13:53 ` Sebastian Huber
4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Huber @ 2017-10-05 13:53 UTC (permalink / raw)
To: newlib
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
index 9db50fe44..4cb15d14b 100644
--- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
+++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h
@@ -179,7 +179,13 @@ typedef struct {
/* POSIX Barrier Types */
#if defined(_POSIX_BARRIERS)
-typedef __uint32_t pthread_barrier_t; /* POSIX Barrier Object */
+typedef struct {
+ unsigned long _flags;
+ struct _Thread_queue_Queue _Queue;
+ unsigned int _count;
+ unsigned int _waiting_threads;
+} pthread_barrier_t;
+
typedef struct {
int is_initialized; /* is this structure initialized? */
#if defined(_POSIX_THREAD_PROCESS_SHARED)
--
2.12.3
^ permalink raw reply [flat|nested] 6+ messages in thread