source:
rtems-tools/tools/4.12/newlib/RTEMS-Add-user-defined-name-to-thread-queues.patch
@
31e22e3
Last change on this file since 31e22e3 was 516f931, checked in by Sebastian Huber <sebastian.huber@…>, on 12/23/16 at 08:06:01 | |
---|---|
|
|
File size: 4.4 KB |
-
newlib/libc/sys/rtems/include/sys/lock.h
From 932cfc4da3a2737e0077164b7d4a6c3e4252ebb2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber <sebastian.huber@embedded-brains.de> Date: Tue, 20 Dec 2016 09:26:54 +0100 Subject: [PATCH] RTEMS: Add user-defined name to thread queues Add a user-defined name to the self-contained synchronization objects in order to make system diagnostics, tracing and debugging more user friendly. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de> --- newlib/libc/sys/rtems/include/sys/lock.h | 66 +++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h index c0549db..ec3415a 100644
a b struct _Thread_queue_Queue { 46 46 struct _Ticket_lock_Control _Lock; 47 47 struct _Thread_queue_Heads *_heads; 48 48 struct _Thread_Control *_owner; 49 const char *_name; 49 50 }; 50 51 51 52 struct _Mutex_Control { … … struct _Futex_Control { 72 73 73 74 #define _TICKET_LOCK_INITIALIZER { 0, 0 } 74 75 75 #define _THREAD_QUEUE_INITIALIZER { _TICKET_LOCK_INITIALIZER, 0, 0 } 76 #define _THREAD_QUEUE_INITIALIZER { _TICKET_LOCK_INITIALIZER, 0, 0, 0 } 77 78 #define _THREAD_QUEUE_NAMED_INITIALIZER(_name) \ 79 { _TICKET_LOCK_INITIALIZER, 0, 0, _name } 76 80 77 81 #define _MUTEX_INITIALIZER { _THREAD_QUEUE_INITIALIZER } 78 82 83 #define _MUTEX_NAMED_INITIALIZER(_name) \ 84 { _THREAD_QUEUE_NAMED_INITIALIZER(_name) } 85 79 86 #define _MUTEX_RECURSIVE_INITIALIZER { _MUTEX_INITIALIZER, 0 } 80 87 88 #define _MUTEX_RECURSIVE_NAMED_INITIALIZER(_name) \ 89 { _MUTEX_NAMED_INITIALIZER(_name), 0 } 90 81 91 #define _CONDITION_INITIALIZER { _THREAD_QUEUE_INITIALIZER } 82 92 93 #define _CONDITION_NAMED_INITIALIZER(_name) \ 94 { _THREAD_QUEUE_NAMED_INITIALIZER(_name) } 95 83 96 #define _SEMAPHORE_INITIALIZER(_count) { _THREAD_QUEUE_INITIALIZER, _count } 84 97 98 #define _SEMAPHORE_NAMED_INITIALIZER(_name, _count) \ 99 { _THREAD_QUEUE_NAMED_INITIALIZER(_name), _count } 100 85 101 #define _FUTEX_INITIALIZER { _THREAD_QUEUE_INITIALIZER } 86 102 103 #define _FUTEX_NAMED_INITIALIZER(_name) \ 104 { _THREAD_QUEUE_NAMED_INITIALIZER(_name) } 105 87 106 static __inline void 88 107 _Mutex_Initialize(struct _Mutex_Control *_mutex) 89 108 { … … _Mutex_Initialize(struct _Mutex_Control *_mutex) 92 111 *_mutex = _init; 93 112 } 94 113 114 static __inline void 115 _Mutex_Initialize_named(struct _Mutex_Control *_mutex, const char *_name) 116 { 117 struct _Mutex_Control _init = _MUTEX_NAMED_INITIALIZER(_name); 118 119 *_mutex = _init; 120 } 121 95 122 void _Mutex_Acquire(struct _Mutex_Control *); 96 123 97 124 int _Mutex_Acquire_timed(struct _Mutex_Control *, const struct timespec *); … … _Mutex_recursive_Initialize(struct _Mutex_recursive_Control *_mutex) 115 142 *_mutex = _init; 116 143 } 117 144 145 static __inline void 146 _Mutex_recursive_Initialize_named(struct _Mutex_recursive_Control *_mutex, 147 const char *_name) 148 { 149 struct _Mutex_recursive_Control _init = 150 _MUTEX_RECURSIVE_NAMED_INITIALIZER(_name); 151 152 *_mutex = _init; 153 } 154 118 155 void _Mutex_recursive_Acquire(struct _Mutex_recursive_Control *); 119 156 120 157 int _Mutex_recursive_Acquire_timed(struct _Mutex_recursive_Control *, … … _Condition_Initialize(struct _Condition_Control *_cond) 139 176 *_cond = _init; 140 177 } 141 178 179 static __inline void 180 _Condition_Initialize_named(struct _Condition_Control *_cond, 181 const char *_name) 182 { 183 struct _Condition_Control _init = _CONDITION_NAMED_INITIALIZER(_name); 184 185 *_cond = _init; 186 } 187 142 188 void _Condition_Wait(struct _Condition_Control *, struct _Mutex_Control *); 143 189 144 190 int _Condition_Wait_timed(struct _Condition_Control *, … … _Semaphore_Initialize(struct _Semaphore_Control *_semaphore, 170 216 *_semaphore = _init; 171 217 } 172 218 219 static __inline void 220 _Semaphore_Initialize_named(struct _Semaphore_Control *_semaphore, 221 const char *_name, unsigned int _count) 222 { 223 struct _Semaphore_Control _init = 224 _SEMAPHORE_NAMED_INITIALIZER(_name, _count); 225 226 *_semaphore = _init; 227 } 228 173 229 void _Semaphore_Wait(struct _Semaphore_Control *); 174 230 175 231 void _Semaphore_Post(struct _Semaphore_Control *); … … _Futex_Initialize(struct _Futex_Control *_futex) 189 245 *_futex = _init; 190 246 } 191 247 248 static __inline void 249 _Futex_Initialize_named(struct _Futex_Control *_futex, const char *_name) 250 { 251 struct _Futex_Control _init = _FUTEX_NAMED_INITIALIZER(_name); 252 253 *_futex = _init; 254 } 255 192 256 int _Futex_Wait(struct _Futex_Control *, int *, int); 193 257 194 258 int _Futex_Wake(struct _Futex_Control *, int);
Note: See TracBrowser
for help on using the repository browser.