diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-07 12:53:41 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-11 10:58:09 +0100 |
commit | 28779c70ffebbb2006eb7df01d64180859bb324e (patch) | |
tree | 18a8a77fce926492c090ca2bea21904d743adeb6 /cpukit | |
parent | score: Add local context to SMP lock API (diff) | |
download | rtems-28779c70ffebbb2006eb7df01d64180859bb324e.tar.bz2 |
score: Add function to destroy SMP locks
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/libcsupport/src/termios.c | 1 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/intr.h | 10 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/isrlock.h | 16 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/smplock.h | 32 |
4 files changed, 55 insertions, 4 deletions
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index 6c88de6260..4022e7c516 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -445,6 +445,7 @@ rtems_termios_close (void *arg) if ((tty->device.pollRead == NULL) || (tty->device.outputUsesInterrupts == TERMIOS_TASK_DRIVEN)) rtems_semaphore_delete (tty->rawInBuf.Semaphore); + rtems_interrupt_lock_destroy (&tty->interrupt_lock); free (tty->rawInBuf.theBuf); free (tty->rawOutBuf.theBuf); free (tty->cbuf); diff --git a/cpukit/rtems/include/rtems/rtems/intr.h b/cpukit/rtems/include/rtems/rtems/intr.h index 62d2dad25a..04bcb72ff4 100644 --- a/cpukit/rtems/include/rtems/rtems/intr.h +++ b/cpukit/rtems/include/rtems/rtems/intr.h @@ -180,6 +180,16 @@ typedef ISR_lock_Context rtems_interrupt_lock_context; _ISR_lock_Initialize( _lock ) /** + * @brief Destroys an interrupt lock. + * + * Concurrent destruction leads to unpredictable results. + * + * @param[in,out] _lock The interrupt lock control. + */ +#define rtems_interrupt_lock_destroy( _lock ) \ + _ISR_lock_Destroy( _lock ) + +/** * @brief Acquires an interrupt lock. * * Interrupts will be disabled. On SMP configurations this function acquires diff --git a/cpukit/score/include/rtems/score/isrlock.h b/cpukit/score/include/rtems/score/isrlock.h index e118475968..27e4aadffa 100644 --- a/cpukit/score/include/rtems/score/isrlock.h +++ b/cpukit/score/include/rtems/score/isrlock.h @@ -95,6 +95,22 @@ static inline void _ISR_lock_Initialize( ISR_lock_Control *lock ) } /** + * @brief Destroys an ISR lock. + * + * Concurrent destruction leads to unpredictable results. + * + * @param[in,out] lock The ISR lock control. + */ +static inline void _ISR_lock_Destroy( ISR_lock_Control *lock ) +{ +#if defined( RTEMS_SMP ) + _SMP_lock_Destroy( &lock->lock ); +#else + (void) lock; +#endif +} + +/** * @brief Acquires an ISR lock. * * Interrupts will be disabled. On SMP configurations this function acquires diff --git a/cpukit/score/include/rtems/score/smplock.h b/cpukit/score/include/rtems/score/smplock.h index 101aa0a6a1..288fd454da 100644 --- a/cpukit/score/include/rtems/score/smplock.h +++ b/cpukit/score/include/rtems/score/smplock.h @@ -64,11 +64,11 @@ typedef struct { { ATOMIC_INITIALIZER_UINT( 0U ), ATOMIC_INITIALIZER_UINT( 0U ) } /** - * @brief Initializes an SMP ticket lock control. + * @brief Initializes an SMP ticket lock. * * Concurrent initialization leads to unpredictable results. * - * @param[out] lock The SMP ticket lock control. + * @param[in,out] lock The SMP ticket lock control. */ static inline void _SMP_ticket_lock_Initialize( SMP_ticket_lock_Control *lock ) { @@ -77,6 +77,18 @@ static inline void _SMP_ticket_lock_Initialize( SMP_ticket_lock_Control *lock ) } /** + * @brief Destroys an SMP ticket lock. + * + * Concurrent destruction leads to unpredictable results. + * + * @param[in,out] lock The SMP ticket lock control. + */ +static inline void _SMP_ticket_lock_Destroy( SMP_ticket_lock_Control *lock ) +{ + (void) lock; +} + +/** * @brief Acquires an SMP ticket lock. * * This function will not disable interrupts. The caller must ensure that the @@ -131,11 +143,11 @@ typedef struct { #define SMP_LOCK_INITIALIZER { SMP_TICKET_LOCK_INITIALIZER } /** - * @brief Initializes an SMP lock control. + * @brief Initializes an SMP lock. * * Concurrent initialization leads to unpredictable results. * - * @param[out] lock The SMP lock control. + * @param[in,out] lock The SMP lock control. */ static inline void _SMP_lock_Initialize( SMP_lock_Control *lock ) { @@ -143,6 +155,18 @@ static inline void _SMP_lock_Initialize( SMP_lock_Control *lock ) } /** + * @brief Destroys an SMP lock. + * + * Concurrent destruction leads to unpredictable results. + * + * @param[in,out] lock The SMP lock control. + */ +static inline void _SMP_lock_Destroy( SMP_lock_Control *lock ) +{ + _SMP_ticket_lock_Destroy( &lock->ticket_lock ); +} + +/** * @brief Acquires an SMP lock. * * This function will not disable interrupts. The caller must ensure that the |