[rtems commit] score: Delete _CORE_RWLock_Timeout()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Apr 22 13:19:35 UTC 2015


I am about to replace the complete thread queue implementation, so there 
is no way back using a previous commit. I currently try to remove all 
the dead or duplicated code to make things simpler so that the final 
replacement patch is as small as possible. There will be a means to do 
specific things during a timeout in the new implementation.

On 22/04/15 15:01, Joel Sherrill wrote:
> Please add a comment to the group in Doxygen to see this commit for getting this back. If POSIX or another standard ever requires reevaluation of the lock and released threads on a timeout.
>
> POSIX is very loose on the discipline of waiting threads and behavior on timeout. It leaves a lot of room for variation. I picked the way we are doing because it was simple and made sense to honor readers and writers in temporal order.
>
> This was a hole to add rwlock unique timeout behavior that could vary by API.
>
> On April 22, 2015 7:23:20 AM CDT, Sebastian Huber <sebh at rtems.org> wrote:
>> Module:    rtems
>> Branch:    master
>> Commit:    b0686b473d8c07e5bbdc1932d7d9b71bfccdf92e
>> Changeset:
>> http://git.rtems.org/rtems/commit/?id=b0686b473d8c07e5bbdc1932d7d9b71bfccdf92e
>>
>> Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
>> Date:      Wed Apr 22 13:57:18 2015 +0200
>>
>> score: Delete _CORE_RWLock_Timeout()
>>
>> This function was identical to _Thread_queue_Timeout().  This makes
>> _Thread_queue_Enqueue_with_handler() obsolete.
>>
>> ---
>>
>> cpukit/score/Makefile.am                          |  2 +-
>> cpukit/score/include/rtems/score/corerwlockimpl.h | 15 --------
>> cpukit/score/include/rtems/score/threadqimpl.h    | 22 ++---------
>> cpukit/score/src/corerwlockobtainread.c           |  5 +--
>> cpukit/score/src/corerwlockobtainwrite.c          |  6 +--
>> cpukit/score/src/corerwlocktimeout.c              | 45
>> -----------------------
>> cpukit/score/src/threadqenqueue.c                 | 11 +++---
>> 7 files changed, 14 insertions(+), 92 deletions(-)
>>
>> diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
>> index 0a6beb4..f8ad60d 100644
>> --- a/cpukit/score/Makefile.am
>> +++ b/cpukit/score/Makefile.am
>> @@ -174,7 +174,7 @@ libscore_a_SOURCES += src/percpuasm.c
>> ## CORE_RWLOCK_C_FILES
>> if HAS_PTHREADS
>> libscore_a_SOURCES += src/corerwlock.c src/corerwlockobtainread.c \
>> -    src/corerwlockobtainwrite.c src/corerwlockrelease.c
>> src/corerwlocktimeout.c
>> +    src/corerwlockobtainwrite.c src/corerwlockrelease.c
>> endif
>>
>> ## CORE_SEMAPHORE_C_FILES
>> diff --git a/cpukit/score/include/rtems/score/corerwlockimpl.h
>> b/cpukit/score/include/rtems/score/corerwlockimpl.h
>> index 66c3b1a..331510b 100644
>> --- a/cpukit/score/include/rtems/score/corerwlockimpl.h
>> +++ b/cpukit/score/include/rtems/score/corerwlockimpl.h
>> @@ -168,21 +168,6 @@ CORE_RWLock_Status _CORE_RWLock_Release(
>>    )
>>
>> /**
>> - *  @brief RWLock specific thread queue timeout.
>> - *
>> - *  This routine processes a thread which timeouts while waiting on
>> - *  an RWLock's thread queue. It is called by the watchdog handler.
>> - *
>> - *  @param[in] id is the Id of thread to timeout
>> - *  @param[in] ignored is an unused pointer to a caller defined area
>> - */
>> -
>> -void _CORE_RWLock_Timeout(
>> -  Objects_Id  id,
>> -  void       *ignored
>> -);
>> -
>> -/**
>>   * This method is used to initialize core rwlock attributes.
>>   *
>>   * @param[in] the_attributes pointer to the attributes to initialize.
>> diff --git a/cpukit/score/include/rtems/score/threadqimpl.h
>> b/cpukit/score/include/rtems/score/threadqimpl.h
>> index 2fa7974..57bdf05 100644
>> --- a/cpukit/score/include/rtems/score/threadqimpl.h
>> +++ b/cpukit/score/include/rtems/score/threadqimpl.h
>> @@ -64,19 +64,6 @@ Thread_Control *_Thread_queue_Dequeue(
>> );
>>
>> /**
>> - *  @brief Enqueues the currently executing thread on
>> the_thread_queue.
>> - *
>> - *  This routine enqueues the currently executing thread on
>> - *  the_thread_queue with an optional timeout.
>> - */
>> -#define _Thread_queue_Enqueue( _the_thread_queue, _the_thread,
>> _timeout ) \
>> -  _Thread_queue_Enqueue_with_handler( \
>> -    _the_thread_queue, \
>> -    _the_thread, \
>> -    _timeout, \
>> -    _Thread_queue_Timeout )
>> -
>> -/**
>>   *  @brief Blocks a thread and places it on a thread.
>>   *
>> *  This routine blocks a thread, places it on a thread, and optionally
>> @@ -89,11 +76,10 @@ Thread_Control *_Thread_queue_Dequeue(
>>   *  - INTERRUPT LATENCY:
>>   *    + single case
>>   */
>> -void _Thread_queue_Enqueue_with_handler(
>> -  Thread_queue_Control         *the_thread_queue,
>> -  Thread_Control               *the_thread,
>> -  Watchdog_Interval             timeout,
>> -  Thread_queue_Timeout_callout  handler
>> +void _Thread_queue_Enqueue(
>> +  Thread_queue_Control *the_thread_queue,
>> +  Thread_Control       *the_thread,
>> +  Watchdog_Interval     timeout
>> );
>>
>> /**
>> diff --git a/cpukit/score/src/corerwlockobtainread.c
>> b/cpukit/score/src/corerwlockobtainread.c
>> index c118e29..f3851b4 100644
>> --- a/cpukit/score/src/corerwlockobtainread.c
>> +++ b/cpukit/score/src/corerwlockobtainread.c
>> @@ -84,11 +84,10 @@ void _CORE_RWLock_Obtain_for_reading(
>>      executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
>>      _ISR_Enable( level );
>>
>> -    _Thread_queue_Enqueue_with_handler(
>> +    _Thread_queue_Enqueue(
>>         &the_rwlock->Wait_queue,
>>         executing,
>> -       timeout,
>> -       _CORE_RWLock_Timeout
>> +       timeout
>>      );
>>
>>      /* return to API level so it can dispatch and we block */
>> diff --git a/cpukit/score/src/corerwlockobtainwrite.c
>> b/cpukit/score/src/corerwlockobtainwrite.c
>> index 40da6c9..ea7d25c 100644
>> --- a/cpukit/score/src/corerwlockobtainwrite.c
>> +++ b/cpukit/score/src/corerwlockobtainwrite.c
>> @@ -74,13 +74,11 @@ void _CORE_RWLock_Obtain_for_writing(
>>      executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
>>      _ISR_Enable( level );
>>
>> -    _Thread_queue_Enqueue_with_handler(
>> +    _Thread_queue_Enqueue(
>>         &the_rwlock->Wait_queue,
>>         executing,
>> -       timeout,
>> -       _CORE_RWLock_Timeout
>> +       timeout
>>      );
>>
>> -
>>      /* return to API level so it can dispatch and we block */
>> }
>> diff --git a/cpukit/score/src/corerwlocktimeout.c
>> b/cpukit/score/src/corerwlocktimeout.c
>> deleted file mode 100644
>> index 2e4b03f..0000000
>> --- a/cpukit/score/src/corerwlocktimeout.c
>> +++ /dev/null
>> @@ -1,45 +0,0 @@
>> -/**
>> - * @file
>> - *
>> - * @brief RWLock Specific Thread Queue Timeout
>> - * @ingroup ScoreRWLock
>> - */
>> -
>> -/*
>> - *  COPYRIGHT (c) 1989-2007.
>> - *  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.
>> - */
>> -
>> -#if HAVE_CONFIG_H
>> -#include "config.h"
>> -#endif
>> -
>> -#include <rtems/score/corerwlockimpl.h>
>> -#include <rtems/score/threadimpl.h>
>> -#include <rtems/score/threadqimpl.h>
>> -
>> -void _CORE_RWLock_Timeout(
>> -  Objects_Id  id,
>> -  void       *ignored
>> -)
>> -{
>> -  Thread_Control       *the_thread;
>> -  Objects_Locations     location;
>> -
>> -  the_thread = _Thread_Get( id, &location );
>> -  switch ( location ) {
>> -    case OBJECTS_ERROR:
>> -#if defined(RTEMS_MULTIPROCESSING)
>> -    case OBJECTS_REMOTE:  /* impossible */
>> -#endif
>> -      break;
>> -    case OBJECTS_LOCAL:
>> -      _Thread_queue_Process_timeout( the_thread );
>> -      _Objects_Put_without_thread_dispatch( &the_thread->Object );
>> -      break;
>> -  }
>> -}
>> diff --git a/cpukit/score/src/threadqenqueue.c
>> b/cpukit/score/src/threadqenqueue.c
>> index c059556..9048551 100644
>> --- a/cpukit/score/src/threadqenqueue.c
>> +++ b/cpukit/score/src/threadqenqueue.c
>> @@ -101,11 +101,10 @@ static void _Thread_queue_Requeue_priority(
>>    );
>> }
>>
>> -void _Thread_queue_Enqueue_with_handler(
>> -  Thread_queue_Control         *the_thread_queue,
>> -  Thread_Control               *the_thread,
>> -  Watchdog_Interval             timeout,
>> -  Thread_queue_Timeout_callout  handler
>> +void _Thread_queue_Enqueue(
>> +  Thread_queue_Control *the_thread_queue,
>> +  Thread_Control       *the_thread,
>> +  Watchdog_Interval     timeout
>> )
>> {
>>    ISR_lock_Context                 lock_context;
>> @@ -127,7 +126,7 @@ void _Thread_queue_Enqueue_with_handler(
>>    if ( timeout ) {
>>      _Watchdog_Initialize(
>>         &the_thread->Timer,
>> -       handler,
>> +       _Thread_queue_Timeout,
>>         the_thread->Object.id,
>>         NULL
>>      );
>>
>> _______________________________________________
>> vc mailing list
>> vc at rtems.org
>> http://lists.rtems.org/mailman/listinfo/vc
> --joel

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list