diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-18 14:03:01 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-18 15:36:58 +0100 |
commit | 5a5fb3b9d6d99d6751d129458217f1a3b5b85ff8 (patch) | |
tree | 9f2296b7e4abaa0da454caea84e2fcbc0eb49fd2 /cpukit/score/include/rtems/score/corespinlock.h | |
parent | score: Add _Objects_Get_by_name() (diff) | |
download | rtems-5a5fb3b9d6d99d6751d129458217f1a3b5b85ff8.tar.bz2 |
score: Avoid Giant lock for CORE spinlock
Use an ISR lock to protect the spinlock state. Remove empty attributes.
Update #2555.
Diffstat (limited to 'cpukit/score/include/rtems/score/corespinlock.h')
-rw-r--r-- | cpukit/score/include/rtems/score/corespinlock.h | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/cpukit/score/include/rtems/score/corespinlock.h b/cpukit/score/include/rtems/score/corespinlock.h index ca50eed5e2..1666538bf6 100644 --- a/cpukit/score/include/rtems/score/corespinlock.h +++ b/cpukit/score/include/rtems/score/corespinlock.h @@ -19,7 +19,8 @@ #ifndef _RTEMS_SCORE_CORESPINLOCK_H #define _RTEMS_SCORE_CORESPINLOCK_H -#include <rtems/score/object.h> +#include <rtems/score/isrlock.h> +#include <rtems/score/thread.h> #ifdef __cplusplus extern "C" { @@ -36,37 +37,34 @@ extern "C" { /**@{*/ /** - * The following defines the control block used to manage the - * attributes of each spinlock. - */ -typedef struct { - /** This element indicates XXX - */ - uint32_t XXX; -} CORE_spinlock_Attributes; - -/** * The following defines the control block used to manage each * spinlock. */ typedef struct { - /** XXX may not be needed */ - CORE_spinlock_Attributes Attributes; + /** + * @brief Lock to protect the other fields. + * + * This implementation is a bit stupid. However, test cases in the Linux + * Test Project do things like sleep() and printf() while owning a + * pthread_spinlock_t, e.g. + * testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c + */ + ISR_LOCK_MEMBER( Lock ) /** This field is the lock. */ - volatile uint32_t lock; + uint32_t lock; /** This field is a count of the current number of threads using * this spinlock. It includes the thread holding the lock as well * as those waiting. */ - volatile uint32_t users; + uint32_t users; /** This field is the Id of the thread holding the lock. It may or may * not be the thread which acquired it. */ - volatile Objects_Id holder; + Thread_Control *holder; } CORE_spinlock_Control; /**@}*/ |