summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/corespinlockimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-16 14:50:09 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-23 12:52:06 +0100
commitc42be504c92d76d2e06d0fc8ebd05fc913376d2d (patch)
tree259f8a712a6139f427888647955bc3c95480877e /cpukit/score/include/rtems/score/corespinlockimpl.h
parentscore: Add RTEMS_ALIAS() (diff)
downloadrtems-c42be504c92d76d2e06d0fc8ebd05fc913376d2d.tar.bz2
posix: Add self-contained pthread spinlock
Turn pthread_spinlock_t into a self-contained object. On uni-processor configurations, interrupts are disabled in the lock/trylock operations and the previous interrupt status is restored in the corresponding unlock operations. On SMP configurations, a ticket lock is a acquired and released in addition. The self-contained pthread_spinlock_t object is defined by Newlib in <sys/_pthreadtypes.h>. typedef struct { struct _Ticket_lock_Control _lock; __uint32_t _interrupt_state; } pthread_spinlock_t; This implementation is simple and efficient. However, this test case of the Linux Test Project would fail due to call of printf() and sleep() during spin lock ownership: https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c There is only limited support for profiling on SMP configurations. Delete CORE spinlock implementation. Update #2674.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/corespinlockimpl.h130
1 files changed, 0 insertions, 130 deletions
diff --git a/cpukit/score/include/rtems/score/corespinlockimpl.h b/cpukit/score/include/rtems/score/corespinlockimpl.h
deleted file mode 100644
index 140529b573..0000000000
--- a/cpukit/score/include/rtems/score/corespinlockimpl.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * @file
- *
- * @brief Inlined Routines Associated with the SuperCore Spinlock
- *
- * This include file contains all of the inlined routines associated
- * with the SuperCore spinlock.
- */
-
-/*
- * COPYRIGHT (c) 1989-2008.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_SCORE_CORESPINLOCKIMPL_H
-#define _RTEMS_SCORE_CORESPINLOCKIMPL_H
-
-#include <rtems/score/corespinlock.h>
-#include <rtems/score/status.h>
-#include <rtems/score/watchdog.h>
-
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ScoreSpinlock
- */
-/**@{**/
-
-/** This indicates the lock is available. */
-#define CORE_SPINLOCK_UNLOCKED 0
-
-/** This indicates the lock is unavailable. */
-#define CORE_SPINLOCK_LOCKED 1
-
-/**
- * @brief Initialize the spinlock.
- *
- * This routine initializes the spinlock based on the parameters passed.
- *
- * @param[in] the_spinlock is the spinlock control block to initialize
- */
-RTEMS_INLINE_ROUTINE void _CORE_spinlock_Initialize(
- CORE_spinlock_Control *the_spinlock
-)
-{
- memset( the_spinlock, 0, sizeof( *the_spinlock ) );
-}
-
-RTEMS_INLINE_ROUTINE void _CORE_spinlock_Acquire_critical(
- CORE_spinlock_Control *the_spinlock,
- ISR_lock_Context *lock_context
-)
-{
- _ISR_lock_Acquire( &the_spinlock->Lock, lock_context );
-}
-
-RTEMS_INLINE_ROUTINE void _CORE_spinlock_Release(
- CORE_spinlock_Control *the_spinlock,
- ISR_lock_Context *lock_context
-)
-{
- _ISR_lock_Release_and_ISR_enable( &the_spinlock->Lock, lock_context );
-}
-
-/**
- * @brief Wait for spinlock.
- *
- * This routine wait for the spinlock to be released. If the spinlock
- * is set to automatic and this is the appropriate thread, then it returns
- * immediately. Otherwise, the calling thread is blocked until the spinlock
- * is released.
- *
- * @param[in] the_spinlock is the spinlock to wait for
- * @param[in] wait is true if willing to wait
- * @param[in] timeout is the maximum number of ticks to spin (0 is forever)
- *
- * @retval A status is returned which indicates the success or failure of
- * this operation.
- */
-Status_Control _CORE_spinlock_Seize(
- CORE_spinlock_Control *the_spinlock,
- bool wait,
- Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
-);
-
-/**
- * @brief Manually release the spinlock.
- *
- * This routine manually releases the spinlock. All of the threads waiting
- * for the spinlock will be readied.
- *
- * @param[in] the_spinlock is the spinlock to surrender
- */
-Status_Control _CORE_spinlock_Surrender(
- CORE_spinlock_Control *the_spinlock,
- ISR_lock_Context *lock_context
-);
-
-/**
- * This method is used to determine if the spinlock is available or not.
- *
- * @param[in] the_spinlock will be checked
- *
- * @return This method will return true if the spinlock is busy
- * and false otherwise.
- */
-RTEMS_INLINE_ROUTINE bool _CORE_spinlock_Is_busy(
- CORE_spinlock_Control *the_spinlock
-)
-{
- return (the_spinlock->users != 0);
-}
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* end of include file */