diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-23 15:05:32 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-24 14:35:04 +0100 |
commit | 57947f137c26c47c5c08b1aa9ab2b51f0a7463bb (patch) | |
tree | 1fcf0a33953cfb757da97e1054ccdaaf5f2728e9 /cpukit/score/include/rtems/score/thread.h | |
parent | score: Add thread priority change handler (diff) | |
download | rtems-57947f137c26c47c5c08b1aa9ab2b51f0a7463bb.tar.bz2 |
score: Add thread lock
Update #2273.
Diffstat (limited to 'cpukit/score/include/rtems/score/thread.h')
-rw-r--r-- | cpukit/score/include/rtems/score/thread.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index ee7886c934..ef238a339d 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -618,6 +618,42 @@ typedef struct { void * control; }Thread_Capture_control; +#if defined(RTEMS_SMP) +/** + * @brief Thread lock control. + * + * The thread lock is either the default lock or the lock of the resource on + * which the thread is currently blocked. The generation number takes care + * that the up to date lock is used. Only resources using fine grained locking + * provide their own lock. + * + * The thread lock protects the following thread variables + * - Thread_Control::current_priority, + * - Thread_Control::Priority::change_handler, and + * - Thread_Control::Priority::change_handler_context. + * + * @see _Thread_Lock_acquire(), _Thread_Lock_release(), _Thread_Lock_set() and + * _Thread_Lock_restore_default(). + */ +typedef struct { + /** + * @brief The current thread lock. + */ + ISR_lock_Control *current; + + /** + * @brief The default thread lock in case the thread is not blocked on a + * resource. + */ + ISR_lock_Control Default; + + /** + * @brief Generation number to invalidate stale locks. + */ + Atomic_Uint generation; +} Thread_Lock_control; +#endif + /** * This structure defines the Thread Control Block (TCB). */ @@ -640,6 +676,14 @@ struct Thread_Control_struct { /** This field is the number of mutexes currently held by this thread. */ uint32_t resource_count; + +#if defined(RTEMS_SMP) + /** + * @brief Thread lock control. + */ + Thread_Lock_control Lock; +#endif + /** This field is the blocking information for this thread. */ Thread_Wait_information Wait; /** This field is the Watchdog used to manage thread delays and timeouts. */ |