Changeset 047d67a in rtems


Ignore:
Timestamp:
Nov 15, 2006, 2:08:49 PM (13 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
b4e79bc
Parents:
64d01b9
Message:

2006-11-15 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/termios.c, posix/Makefile.am, posix/preinstall.am, posix/include/rtems/posix/config.h, posix/include/rtems/posix/time.h, sapi/src/posixapi.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/corerwlock.h, score/include/rtems/score/threadq.h, score/src/corerwlockobtainread.c, score/src/threadqenqueue.c, score/src/threadqtimeout.c: Adding POSIX barriers, POSIX spinlocks, and partial implementation of POSIX rwlocks.
  • posix/include/rtems/posix/barrier.h, posix/include/rtems/posix/rwlock.h, posix/include/rtems/posix/spinlock.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/spinlock.inl, posix/src/barrierattrdestroy.c, posix/src/barrierattrgetpshared.c, posix/src/barrierattrinit.c, posix/src/barrierattrsetpshared.c, posix/src/pbarrier.c, posix/src/pbarrierdestroy.c, posix/src/pbarrierinit.c, posix/src/pbarriertranslatereturncode.c, posix/src/pbarrierwait.c, posix/src/prwlock.c, posix/src/prwlockdestroy.c, posix/src/prwlockinit.c, posix/src/prwlockrdlock.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/prwlocktranslatereturncode.c, posix/src/prwlocktryrdlock.c, posix/src/prwlocktrywrlock.c, posix/src/prwlockunlock.c, posix/src/prwlockwrlock.c, posix/src/pspin.c, posix/src/pspindestroy.c, posix/src/pspininit.c, posix/src/pspinlock.c, posix/src/pspinlocktranslatereturncode.c, posix/src/pspintrylock.c, posix/src/pspinunlock.c, posix/src/rwlockattrdestroy.c, posix/src/rwlockattrgetpshared.c, posix/src/rwlockattrinit.c, posix/src/rwlockattrsetpshared.c: New files.
Location:
cpukit
Files:
37 added
14 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r64d01b9 r047d67a  
     12006-11-15      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * libcsupport/src/termios.c, posix/Makefile.am, posix/preinstall.am,
     4        posix/include/rtems/posix/config.h, posix/include/rtems/posix/time.h,
     5        sapi/src/posixapi.c, score/Makefile.am, score/preinstall.am,
     6        score/include/rtems/score/corerwlock.h,
     7        score/include/rtems/score/threadq.h,
     8        score/src/corerwlockobtainread.c, score/src/threadqenqueue.c,
     9        score/src/threadqtimeout.c: Adding POSIX barriers, POSIX spinlocks,
     10        and partial implementation of POSIX rwlocks.
     11        * posix/include/rtems/posix/barrier.h,
     12        posix/include/rtems/posix/rwlock.h,
     13        posix/include/rtems/posix/spinlock.h,
     14        posix/inline/rtems/posix/barrier.inl,
     15        posix/inline/rtems/posix/rwlock.inl,
     16        posix/inline/rtems/posix/spinlock.inl,
     17        posix/src/barrierattrdestroy.c, posix/src/barrierattrgetpshared.c,
     18        posix/src/barrierattrinit.c, posix/src/barrierattrsetpshared.c,
     19        posix/src/pbarrier.c, posix/src/pbarrierdestroy.c,
     20        posix/src/pbarrierinit.c, posix/src/pbarriertranslatereturncode.c,
     21        posix/src/pbarrierwait.c, posix/src/prwlock.c,
     22        posix/src/prwlockdestroy.c, posix/src/prwlockinit.c,
     23        posix/src/prwlockrdlock.c, posix/src/prwlocktimedrdlock.c,
     24        posix/src/prwlocktimedwrlock.c,
     25        posix/src/prwlocktranslatereturncode.c, posix/src/prwlocktryrdlock.c,
     26        posix/src/prwlocktrywrlock.c, posix/src/prwlockunlock.c,
     27        posix/src/prwlockwrlock.c, posix/src/pspin.c,
     28        posix/src/pspindestroy.c, posix/src/pspininit.c,
     29        posix/src/pspinlock.c, posix/src/pspinlocktranslatereturncode.c,
     30        posix/src/pspintrylock.c, posix/src/pspinunlock.c,
     31        posix/src/rwlockattrdestroy.c, posix/src/rwlockattrgetpshared.c,
     32        posix/src/rwlockattrinit.c, posix/src/rwlockattrsetpshared.c: New files.
     33
    1342006-11-14      Ralf Corsépius <ralf.corsepius@rtems.org>
    235
  • cpukit/libcsupport/src/termios.c

    r64d01b9 r047d67a  
    10161016        rtems_interval timeout = tty->rawInBufSemaphoreFirstTimeout;
    10171017        rtems_status_code sc;
    1018         int               wait = (int)1;
     1018        int               wait = (int)1;
    10191019
    10201020        while ( wait ) {
  • cpukit/posix/Makefile.am

    r64d01b9 r047d67a  
    2626    include/rtems/posix/pthread.h include/rtems/posix/semaphore.h \
    2727    include/rtems/posix/threadsup.h include/rtems/posix/time.h \
    28     include/rtems/posix/timer.h
     28    include/rtems/posix/timer.h include/rtems/posix/barrier.h \
     29    include/rtems/posix/rwlock.h include/rtems/posix/spinlock.h
    2930
    3031if HAS_MP
     
    3839    inline/rtems/posix/mutex.inl inline/rtems/posix/pthread.inl \
    3940    inline/rtems/posix/priority.inl inline/rtems/posix/semaphore.inl \
    40     inline/rtems/posix/timer.inl
     41    inline/rtems/posix/timer.inl inline/rtems/posix/barrier.inl \
     42    inline/rtems/posix/rwlock.inl inline/rtems/posix/spinlock.inl
    4143
    4244## src
     
    5052    src/execve.c src/execvp.c src/fork.c src/pthreadatfork.c src/wait.c \
    5153    src/waitpid.c
     54
     55## BARRIER_C_FILES
     56libposix_a_SOURCES += src/barrierattrdestroy.c src/barrierattrgetpshared.c \
     57    src/barrierattrinit.c src/barrierattrsetpshared.c src/pbarrier.c \
     58    src/pbarrierdestroy.c src/pbarrierinit.c \
     59    src/pbarriertranslatereturncode.c src/pbarrierwait.c
    5260
    5361## CANCEL_C_FILES
     
    116124    src/sigwait.c src/sigwaitinfo.c src/signal_2.c src/ualarm.c
    117125
     126## RWLOCK_C_FILES
     127libposix_a_SOURCES += src/prwlock.c src/prwlockdestroy.c src/prwlockinit.c \
     128    src/prwlockrdlock.c src/prwlocktimedrdlock.c src/prwlocktimedwrlock.c \
     129    src/prwlocktryrdlock.c src/prwlocktrywrlock.c src/prwlockunlock.c \
     130    src/prwlockwrlock.c src/rwlockattrdestroy.c src/rwlockattrgetpshared.c \
     131    src/rwlockattrinit.c src/rwlockattrsetpshared.c \
     132    src/prwlocktranslatereturncode.c
     133
    118134## SEMAPHORE_C_FILES
    119135libposix_a_SOURCES += src/semaphore.c src/semaphorecreatesupp.c \
     
    122138    src/semgetvalue.c src/seminit.c src/semopen.c src/sempost.c \
    123139    src/semtimedwait.c src/semtrywait.c src/semunlink.c src/semwait.c
     140
     141## SPINLOCK_C_FILES
     142libposix_a_SOURCES += src/pspin.c src/pspindestroy.c src/pspininit.c \
     143    src/pspinlock.c src/pspinlocktranslatereturncode.c src/pspintrylock.c \
     144    src/pspinunlock.c
    124145
    125146## TIME_C_FILES
  • cpukit/posix/include/rtems/posix/config.h

    r64d01b9 r047d67a  
    5555  int                                 maximum_message_queues;
    5656  int                                 maximum_semaphores;
     57  int                                 maximum_barriers;
     58  int                                 maximum_rwlocks;
     59  int                                 maximum_spinlocks;
    5760  int                                 number_of_initialization_threads;
    5861  posix_initialization_threads_table *User_initialization_threads_table;
  • cpukit/posix/include/rtems/posix/time.h

    r64d01b9 r047d67a  
    2323  (4 * TOD_SECONDS_PER_DAY))
    2424
    25 /*PAGE
    26  *
     25/*
    2726 *  _POSIX_Timespec_subtract
    2827 */
     
    4241);
    4342
    44 /*PAGE
    45  *
     43/*
    4644 *  _POSIX_Interval_to_timespec
    4745 */
     
    5250);
    5351
     52/*
     53 *  _POSIX_Absolute_timeout_to_ticks
     54 */
     55int _POSIX_Absolute_timeout_to_ticks(
     56  const struct timespec *abstime,
     57  Watchdog_Interval     *ticks_out
     58);
     59
    5460#endif
  • cpukit/posix/preinstall.am

    r64d01b9 r047d67a  
    4545PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    4646
     47$(PROJECT_INCLUDE)/rtems/posix/barrier.h: include/rtems/posix/barrier.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     48        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/barrier.h
     49PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/barrier.h
     50
    4751$(PROJECT_INCLUDE)/rtems/posix/cancel.h: include/rtems/posix/cancel.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    4852        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/cancel.h
     
    8589PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/pthread.h
    8690
     91$(PROJECT_INCLUDE)/rtems/posix/rwlock.h: include/rtems/posix/rwlock.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     92        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/rwlock.h
     93PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/rwlock.h
     94
    8795$(PROJECT_INCLUDE)/rtems/posix/semaphore.h: include/rtems/posix/semaphore.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    8896        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/semaphore.h
    8997PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/semaphore.h
     98
     99$(PROJECT_INCLUDE)/rtems/posix/spinlock.h: include/rtems/posix/spinlock.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     100        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlock.h
     101PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlock.h
    90102
    91103$(PROJECT_INCLUDE)/rtems/posix/threadsup.h: include/rtems/posix/threadsup.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     
    122134PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/semaphoremp.h
    123135endif
     136
     137$(PROJECT_INCLUDE)/rtems/posix/barrier.inl: inline/rtems/posix/barrier.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     138        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/barrier.inl
     139PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/barrier.inl
     140
    124141$(PROJECT_INCLUDE)/rtems/posix/cond.inl: inline/rtems/posix/cond.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    125142        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/cond.inl
     
    146163PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/priority.inl
    147164
     165$(PROJECT_INCLUDE)/rtems/posix/rwlock.inl: inline/rtems/posix/rwlock.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     166        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/rwlock.inl
     167PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/rwlock.inl
     168
    148169$(PROJECT_INCLUDE)/rtems/posix/semaphore.inl: inline/rtems/posix/semaphore.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    149170        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/semaphore.inl
    150171PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/semaphore.inl
     172
     173$(PROJECT_INCLUDE)/rtems/posix/spinlock.inl: inline/rtems/posix/spinlock.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     174        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlock.inl
     175PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlock.inl
    151176
    152177$(PROJECT_INCLUDE)/rtems/posix/timer.inl: inline/rtems/posix/timer.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
  • cpukit/sapi/src/posixapi.c

    r64d01b9 r047d67a  
    3434#include <rtems/config.h>
    3535#include <rtems/score/object.h>
    36 /* #include <rtems/posix/barrier.h> */
     36#include <rtems/posix/barrier.h>
    3737#include <rtems/posix/cond.h>
    3838#include <rtems/posix/config.h>
     
    4343#include <rtems/posix/psignal.h>
    4444#include <rtems/posix/pthread.h>
    45 /* #include <rtems/posix/rwlock.h> */
     45#include <rtems/posix/rwlock.h>
    4646#include <rtems/posix/timer.h>
    4747#include <rtems/posix/semaphore.h>
    48 /* #include <rtems/posix/spinlock.h> */
     48#include <rtems/posix/spinlock.h>
    4949#include <rtems/posix/time.h>
    5050
     
    6666  0,                             /* maximum_message_queues */
    6767  0,                             /* maximum_semaphores */
    68 #if 0
    6968  0,                             /* maximum_barriers */
    7069  0,                             /* maximum_spinlocks */
    7170  0,                             /* maximum_rwlocks */
    72 #endif
    7371  NULL                           /* User_initialization_threads_table */
    7472};
     
    123121  _POSIX_Timer_Manager_initialization( api_configuration->maximum_timers );
    124122
    125   /* temporary while working */
    126 #if 0
    127123  _POSIX_Barrier_Manager_initialization( api_configuration->maximum_barriers );
    128124
     
    130126
    131127  _POSIX_Spinlock_Manager_initialization(api_configuration->maximum_spinlocks);
    132 #endif
    133128}
    134129
  • cpukit/score/Makefile.am

    r64d01b9 r047d67a  
    5151    inline/rtems/score/stack.inl inline/rtems/score/states.inl \
    5252    inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \
    53     inline/rtems/score/tod.inl inline/rtems/score/tqdata.inl \
    54     inline/rtems/score/userext.inl inline/rtems/score/watchdog.inl \
    55     inline/rtems/score/wkspace.inl
     53    inline/rtems/score/threadq.inl inline/rtems/score/tod.inl \
     54    inline/rtems/score/tqdata.inl inline/rtems/score/userext.inl \
     55    inline/rtems/score/watchdog.inl inline/rtems/score/wkspace.inl
    5656
    5757if HAS_MP
     
    9292## CORE_RWLOCK_C_FILES
    9393libscore_a_SOURCES += src/corerwlock.c src/corerwlockobtainread.c \
    94     src/corerwlockobtainwrite.c src/corerwlockrelease.c
     94    src/corerwlockobtainwrite.c src/corerwlockrelease.c src/corerwlocktimeout.c
    9595
    9696## CORE_SEMAPHORE_C_FILES
  • cpukit/score/include/rtems/score/corerwlock.h

    r64d01b9 r047d67a  
    206206  )
    207207
     208/**
     209 *  @brief RWLock Specific Thread Queue Timeout
     210 *
     211 *  This routine processes a thread which timeouts while waiting on
     212 *  an RWLock's thread queue. It is called by the watchdog handler.
     213 *
     214 *  @param[in] id is the Id of thread to timeout
     215 *  @param[in] ignored is an unused pointer to a caller defined area
     216 */
     217
     218void _CORE_RWLock_Timeout(
     219  Objects_Id  id,
     220  void       *ignored
     221);
     222
     223
    208224#ifndef __RTEMS_APPLICATION__
    209225#include <rtems/score/corerwlock.inl>
  • cpukit/score/include/rtems/score/threadq.h

    r64d01b9 r047d67a  
    4848 */
    4949typedef void ( *Thread_queue_Flush_callout )(
    50                  Thread_Control *
     50                  Thread_Control *
     51             );
     52
     53/**
     54 *
     55 * The following type defines the callout used for timeout processing
     56 * methods.
     57 */
     58typedef void ( *Thread_queue_Timeout_callout )(
     59                 Objects_Id,
     60                 void *
    5161             );
    5262
     
    6272);
    6373
     74/** @brief  Thread queue Enqueue Wrapper
     75 *
     76 *  This routine enqueues the currently executing thread on
     77 *  the_thread_queue with an optional timeout.
     78 */
     79#define _Thread_queue_Enqueue( _the_thread_queue, _timeout ) \
     80  _Thread_queue_Enqueue_with_handler( \
     81    _the_thread_queue, \
     82    _timeout, \
     83    _Thread_queue_Timeout )
     84 
     85
    6486/** @brief  Thread queue Enqueue
    6587 *
     
    6789 *  the_thread_queue with an optional timeout.
    6890 */
    69 void _Thread_queue_Enqueue(
    70   Thread_queue_Control *the_thread_queue,
    71   Watchdog_Interval     timeout
     91void _Thread_queue_Enqueue_with_handler(
     92  Thread_queue_Control*        the_thread_queue,
     93  Watchdog_Interval            timeout,
     94  Thread_queue_Timeout_callout handler
    7295);
    7396
     
    221244);
    222245
     246
     247#ifndef __RTEMS_APPLICATION__
     248#include <rtems/score/threadq.inl>
     249#endif
     250
    223251#ifdef __cplusplus
    224252}
  • cpukit/score/preinstall.am

    r64d01b9 r047d67a  
    233233PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/thread.inl
    234234
     235$(PROJECT_INCLUDE)/rtems/score/threadq.inl: inline/rtems/score/threadq.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     236        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threadq.inl
     237PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadq.inl
     238
    235239$(PROJECT_INCLUDE)/rtems/score/tod.inl: inline/rtems/score/tod.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
    236240        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/tod.inl
  • cpukit/score/src/corerwlockobtainread.c

    r64d01b9 r047d67a  
    9898    _ISR_Enable( level );
    9999
    100     _Thread_queue_Enqueue( &the_rwlock->Wait_queue, timeout );
     100    _Thread_queue_Enqueue_with_handler(
     101       &the_rwlock->Wait_queue,
     102       timeout,
     103       _CORE_RWLock_Timeout
     104    );
    101105
    102106    /* return to API level so it can dispatch and we block */
  • cpukit/score/src/threadqenqueue.c

    r64d01b9 r047d67a  
    3131/*PAGE
    3232 *
    33  *  _Thread_queue_Enqueue
     33 *  _Thread_queue_Enqueue_with_handler
    3434 *
    3535 *  This routine blocks a thread, places it on a thread, and optionally
     
    4646 */
    4747
    48 void _Thread_queue_Enqueue(
    49   Thread_queue_Control *the_thread_queue,
    50   Watchdog_Interval     timeout
     48void _Thread_queue_Enqueue_with_handler(
     49  Thread_queue_Control         *the_thread_queue,
     50  Watchdog_Interval             timeout,
     51  Thread_queue_Timeout_callout  handler
    5152)
    5253{
     
    6566    _Watchdog_Initialize(
    6667       &the_thread->Timer,
    67        _Thread_queue_Timeout,
     68       handler,
    6869       the_thread->Object.id,
    6970       NULL
  • cpukit/score/src/threadqtimeout.c

    r64d01b9 r047d67a  
    2626#include <rtems/score/tqdata.h>
    2727
    28 /*PAGE
    29  *
     28/*
    3029 *  _Thread_queue_Timeout
    3130 *
     
    4544{
    4645  Thread_Control       *the_thread;
    47   Thread_queue_Control *the_thread_queue;
    4846  Objects_Locations     location;
    4947
     
    5452      break;
    5553    case OBJECTS_LOCAL:
    56       the_thread_queue = the_thread->Wait.queue;
    57 
    58       /*
    59        *  If the_thread_queue is not synchronized, then it is either
    60        *  "nothing happened", "timeout", or "satisfied".   If the_thread
    61        *  is the executing thread, then it is in the process of blocking
    62        *  and it is the thread which is responsible for the synchronization
    63        *  process.
    64        *
    65        *  If it is not satisfied, then it is "nothing happened" and
    66        *  this is the "timeout" transition.  After a request is satisfied,
    67        *  a timeout is not allowed to occur.
    68        */
    69 
    70       if ( the_thread_queue->sync_state != THREAD_QUEUE_SYNCHRONIZED &&
    71            _Thread_Is_executing( the_thread ) ) {
    72         if ( the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED )
    73           the_thread_queue->sync_state = THREAD_QUEUE_TIMEOUT;
    74       } else {
    75         the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status;
    76         _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
    77       }
     54      _Thread_queue_Process_timeout( the_thread );
    7855      _Thread_Unnest_dispatch();
    7956      break;
Note: See TracChangeset for help on using the changeset viewer.