diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-03 07:43:54 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-30 14:36:18 +0200 |
commit | dfcc8bb2a6a0c9983a22268a933ef1f21a07eaaa (patch) | |
tree | e1f16d3c3cfec5716bdceec6425398c7b83eaafe /cpukit/score/include/rtems/score | |
parent | score: Use Newlib provided <machine/endian.h> (diff) | |
download | rtems-dfcc8bb2a6a0c9983a22268a933ef1f21a07eaaa.tar.bz2 |
score: Adjust thread queue layout
Adjust thread queue layout according to Newlib. This makes it possible
to use the same implementation for <sys/lock.h> and CORE mutexes in the
future.
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r-- | cpukit/score/include/rtems/score/threadq.h | 26 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/threadqimpl.h | 7 |
2 files changed, 21 insertions, 12 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 27af89fa75..467462d2b8 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -155,26 +155,34 @@ typedef struct _Thread_queue_Heads { typedef struct { /** - * @brief The thread queue heads. - * - * This pointer is NULL, if and only if no threads are enqueued. The first - * thread to enqueue will give its spare thread queue heads to this thread - * queue. - */ - Thread_queue_Heads *heads; - - /** * @brief Lock to protect this thread queue. * * It may be used to protect additional state of the object embedding this * thread queue. * + * Must be the first component of this structure to be able to re-use + * implementation parts for structures defined by Newlib <sys/lock.h>. + * * @see _Thread_queue_Acquire(), _Thread_queue_Acquire_critical() and * _Thread_queue_Release(). */ #if defined(RTEMS_SMP) SMP_ticket_lock_Control Lock; #endif + + /** + * @brief The thread queue heads. + * + * This pointer is NULL, if and only if no threads are enqueued. The first + * thread to enqueue will give its spare thread queue heads to this thread + * queue. + */ + Thread_queue_Heads *heads; + + /** + * @brief The thread queue owner. + */ + Thread_Control *owner; } Thread_queue_Queue; /** diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h index 7489d5466b..a8f404f299 100644 --- a/cpukit/score/include/rtems/score/threadqimpl.h +++ b/cpukit/score/include/rtems/score/threadqimpl.h @@ -40,8 +40,6 @@ extern "C" { * defined in Newlib <sys/lock.h>. */ typedef struct { - Thread_queue_Queue Queue; - #if !defined(RTEMS_SMP) /* * The struct _Thread_queue_Queue definition is independent of the RTEMS @@ -51,6 +49,8 @@ typedef struct { */ unsigned int reserved[2]; #endif + + Thread_queue_Queue Queue; } Thread_queue_Syslock_queue; RTEMS_INLINE_ROUTINE void _Thread_queue_Do_context_initialize( @@ -115,10 +115,11 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_initialize( Thread_queue_Queue *queue ) { - queue->heads = NULL; #if defined(RTEMS_SMP) _SMP_ticket_lock_Initialize( &queue->Lock ); #endif + queue->heads = NULL; + queue->owner = NULL; } RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_do_acquire_critical( |