Changeset 6a0898b in rtems


Ignore:
Timestamp:
Jul 18, 2008, 6:45:56 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.9, master
Children:
acb4bed0
Parents:
d3c32136
Message:

2008-07-18 Joel Sherrill <joel.sherrill@…>

PR 1291/cpukit

  • itron/inline/rtems/itron/semaphore.inl, itron/src/twai_sem.c, posix/include/mqueue.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/semaphore.h, posix/include/rtems/posix/time.h, posix/src/condtimedwait.c, posix/src/mqueuereceive.c, posix/src/mqueuerecvsupp.c, posix/src/mqueuesend.c, posix/src/mqueuesendsupp.c, posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c, posix/src/mutextimedlock.c, posix/src/mutextranslatereturncode.c, posix/src/posixtimespecabsolutetimeout.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/semaphoretranslatereturncode.c, posix/src/semaphorewaitsupp.c, posix/src/semtimedwait.c, posix/src/semtrywait.c, posix/src/semwait.c, posix/src/sigtimedwait.c, posix/src/timersettime.c, posix/src/ualarm.c, rtems/src/semobtain.c, rtems/src/semtranslatereturncode.c, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/src/coresemseize.c: This patch addresses issues on implementation of the timeout on the following POSIX services. Some of these services incorrectly took a timeout as a relative time. Others would compute a 0 delta to timeout if the absolute time and the current time were equal and thus incorrectly block the caller forever. The root of the confusion is that POSIX specifies that if the timeout is incorrect (e.g. in the past, is now, or is numerically invalid), that it does not matter if the call would succeed without blocking. This is in contrast to RTEMS programming style where all errors are checked before any critical sections are entered. This fix implemented a more uniform way of handling POSIX absolute time timeouts.

+ pthread_cond_timedwait - could block forever
+ mq_timedreceive - used relative not absolute time
+ mq_timedsend - used relative not absolute time
+ pthread_mutex_timedlock - used relative not absolute time
+ pthread_rwlock_timedrdlock- used relative not absolute time
+ pthread_rwlock_timedwrlock- used relative not absolute time
+ sem_timedwait - could block forever

Location:
cpukit
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rd3c32136 r6a0898b  
     12008-07-18      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        PR 1291/cpukit
     4        * itron/inline/rtems/itron/semaphore.inl, itron/src/twai_sem.c,
     5        posix/include/mqueue.h, posix/include/rtems/posix/mqueue.h,
     6        posix/include/rtems/posix/semaphore.h,
     7        posix/include/rtems/posix/time.h, posix/src/condtimedwait.c,
     8        posix/src/mqueuereceive.c, posix/src/mqueuerecvsupp.c,
     9        posix/src/mqueuesend.c, posix/src/mqueuesendsupp.c,
     10        posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c,
     11        posix/src/mutextimedlock.c, posix/src/mutextranslatereturncode.c,
     12        posix/src/posixtimespecabsolutetimeout.c,
     13        posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c,
     14        posix/src/semaphoretranslatereturncode.c,
     15        posix/src/semaphorewaitsupp.c, posix/src/semtimedwait.c,
     16        posix/src/semtrywait.c, posix/src/semwait.c,
     17        posix/src/sigtimedwait.c, posix/src/timersettime.c,
     18        posix/src/ualarm.c, rtems/src/semobtain.c,
     19        rtems/src/semtranslatereturncode.c,
     20        score/include/rtems/score/coremutex.h,
     21        score/include/rtems/score/coresem.h, score/src/coresemseize.c: This
     22        patch addresses issues on implementation of the timeout on the
     23        following POSIX services. Some of these services incorrectly took a
     24        timeout as a relative time. Others would compute a 0 delta to timeout
     25        if the absolute time and the current time were equal and thus
     26        incorrectly block the caller forever. The root of the confusion is
     27        that POSIX specifies that if the timeout is incorrect (e.g. in the
     28        past, is now, or is numerically invalid), that it does not matter if
     29        the call would succeed without blocking. This is in contrast to RTEMS
     30        programming style where all errors are checked before any critical
     31        sections are entered. This fix implemented a more uniform way of
     32        handling POSIX absolute time timeouts.
     33            + pthread_cond_timedwait - could block forever
     34            + mq_timedreceive - used relative not absolute time
     35            + mq_timedsend - used relative not absolute time
     36            + pthread_mutex_timedlock - used relative not absolute time
     37            + pthread_rwlock_timedrdlock- used relative not absolute time
     38            + pthread_rwlock_timedwrlock- used relative not absolute time
     39            + sem_timedwait - could block forever
     40
    1412008-07-17      Joel Sherrill <joel.sherrill@oarcorp.com>
    242
  • cpukit/itron/inline/rtems/itron/semaphore.inl

    rd3c32136 r6a0898b  
    173173    case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED:
    174174      return E_QOVR;
    175     case CORE_SEMAPHORE_BAD_TIMEOUT_VALUE:
    176       return E_PAR;
    177175    case THREAD_STATUS_PROXY_BLOCKING:
    178176      return THREAD_STATUS_PROXY_BLOCKING;
  • cpukit/itron/src/twai_sem.c

    rd3c32136 r6a0898b  
    11/*
    2  *  COPYRIGHT (c) 1989-2007.
     2 *  COPYRIGHT (c) 1989-2008.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    3131)
    3232{
    33   ITRON_Semaphore_Control        *the_semaphore;
    34   Objects_Locations               location;
    35   Watchdog_Interval               interval;
    36   Core_semaphore_Blocking_option  blocking;
     33  ITRON_Semaphore_Control  *the_semaphore;
     34  Objects_Locations         location;
     35  Watchdog_Interval         interval;
     36  boolean                   blocking;
    3737
    3838  interval = 0;
    3939  if ( tmout == TMO_POL ) {
    40     blocking = CORE_SEMAPHORE_NO_WAIT;
     40    blocking = FALSE;
    4141  } else {
    42     blocking = CORE_SEMAPHORE_BLOCK_FOREVER;
     42    blocking = TRUE;
    4343
    4444    if ( tmout != TMO_FEVR )
  • cpukit/posix/include/mqueue.h

    rd3c32136 r6a0898b  
    44
    55/*
    6  *  COPYRIGHT (c) 1989-2007.
     6 *  COPYRIGHT (c) 1989-2008.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    3434 */
    3535
     36/**
     37 *  Message queue id type
     38 */
    3639typedef Objects_Id  mqd_t;
    3740
     41/**
     42 *  This is the message queue attributes structure.
     43 */
    3844struct mq_attr {
    39   long  mq_flags;     /* Message queue flags */
    40   long  mq_maxmsg;    /* Maximum number of messages */
    41   long  mq_msgsize;   /* Maximum message size */
    42   long  mq_curmsgs;   /* Number of messages currently queued */
     45  /** This is the message queue flags */
     46  long  mq_flags;
     47  /** This is the maximum number of messages */
     48  long  mq_maxmsg;
     49  /** This is the maximum message size */
     50  long  mq_msgsize;
     51  /** This is the mumber of messages currently queued */
     52  long  mq_curmsgs;
    4353};
    4454
    45 /*
     55/**
    4656 *  15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
    4757 */
    48 
    4958mqd_t mq_open(
    5059  const char *name,
     
    5362);
    5463
    55 /*
     64/**
    5665 *  15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
    5766 */
    58 
    5967int mq_close(
    6068  mqd_t  mqdes
    6169);
    6270
    63 /*
     71/**
    6472 *  15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
    6573 */
    66 
    6774int mq_unlink(
    6875  const char *name
    6976);
    7077
    71 /*
     78/**
    7279 *  15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
    7380 *
    74  *  NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
     81 *  @note P1003.4b/D8, p. 45 adds mq_timedsend().
    7582 */
    76 
    7783int mq_send(
    7884  mqd_t         mqdes,
     
    9197  size_t                 msg_len,
    9298  unsigned int           msg_prio,
    93   const struct timespec *timeout
     99  const struct timespec *abstime
    94100);
    95101
     
    116122  size_t                 msg_len,
    117123  unsigned int          *msg_prio,
    118   const struct timespec *timeout
     124  const struct timespec *abstime
    119125);
    120126
  • cpukit/posix/include/rtems/posix/mqueue.h

    rd3c32136 r6a0898b  
    77 
    88/*
    9  *  COPYRIGHT (c) 1989-1999.
     9 *  COPYRIGHT (c) 1989-2008.
    1010 *  On-Line Applications Research Corporation (OAR).
    1111 *
     
    113113  size_t              msg_len,
    114114  unsigned int       *msg_prio,
     115  boolean             wait,
    115116  Watchdog_Interval   timeout
    116117);
     
    129130  size_t              msg_len,
    130131  uint32_t            msg_prio,
     132  boolean             wait,
    131133  Watchdog_Interval   timeout
    132134);
  • cpukit/posix/include/rtems/posix/semaphore.h

    rd3c32136 r6a0898b  
    88 *  POSIX Semaphores.
    99 *
    10  *  COPYRIGHT (c) 1989-2007.
     10 *  COPYRIGHT (c) 1989-2008.
    1111 *  On-Line Applications Research Corporation (OAR).
    1212 *
     
    154154
    155155int _POSIX_Semaphore_Wait_support(
    156   sem_t                          *sem,
    157   Core_semaphore_Blocking_option  blocking,
    158   Watchdog_Interval               timeout
     156  sem_t               *sem,
     157  boolean              blocking,
     158  Watchdog_Interval    timeout
    159159);
    160160
  • cpukit/posix/include/rtems/posix/time.h

    rd3c32136 r6a0898b  
    44
    55/*
    6  *  COPYRIGHT (c) 1989-2007.
     6 *  COPYRIGHT (c) 1989-2008.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    1919#include <rtems/score/timespec.h>
    2020
    21 /*
    22  *  _POSIX_Absolute_timeout_to_ticks
     21/** @brief Absolute Timeout Conversion Results
     22 *
     23 *  This enumeration defines the possible results of converting
     24 *  an absolute time used for timeouts to POSIX blocking calls to
     25 *  a number of ticks.
    2326 */
    24 int _POSIX_Absolute_timeout_to_ticks(
     27typedef enum {
     28  /** The timeout is invalid. */
     29  POSIX_ABSOLUTE_TIMEOUT_INVALID,
     30  /** The timeout represents a time that is in the past. */
     31  POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST,
     32  /** The timeout represents a time that is equal to the current time. */
     33  POSIX_ABSOLUTE_TIMEOUT_IS_NOW,
     34  /** The timeout represents a time that is in the future. */
     35  POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE,
     36} POSIX_Absolute_timeout_conversion_results_t;
     37
     38/**
     39 *  @brief Convert Absolute Timeout to Ticks
     40 *
     41 *  This method takes an absolute time being used as a timeout
     42 *  to a blocking directive, validates it and returns the number
     43 *  of corresponding clock ticks for use by the SuperCore.
     44 *
     45 *  @param[in] abstime is the timeout
     46 *  @param[in] ticks_out will contain the number of ticks
     47 *
     48 *  @return This method returns the number of ticks in @a ticks_out
     49 *          and a status value indicating whether the absolute time
     50 *          is valid, in the past, equal to the current time or in
     51 *          the future as it should be.
     52 */
     53POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks(
    2554  const struct timespec *abstime,
    2655  Watchdog_Interval     *ticks_out
  • cpukit/posix/src/condtimedwait.c

    rd3c32136 r6a0898b  
    44
    55/*
    6  *  COPYRIGHT (c) 1989-2007.
     6 *  COPYRIGHT (c) 1989-2008.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    4040)
    4141{
    42   Watchdog_Interval timeout;
    43   struct timespec   current_time;
    44   struct timespec   difference;
    45   boolean           already_timedout = FALSE;
    46 
    47   if ( !_Timespec_Is_valid(abstime) )
    48     return EINVAL;
     42  Watchdog_Interval ticks;
     43  boolean           already_timedout;
    4944
    5045  /*
    51    *  The abstime is a walltime.  We turn it into an interval.
     46   *  POSIX requires that blocking calls with timeouts that take
     47   *  an absolute timeout must ignore issues with the absolute
     48   *  time provided if the operation would otherwise succeed.
     49   *  So we check the abstime provided, and hold on to whether it
     50   *  is valid or not.  If it isn't correct and in the future,
     51   *  then we do a polling operation and convert the UNSATISFIED
     52   *  status into the appropriate error.
    5253   */
    53 
    54   _TOD_Get( &current_time );
    55 
    56   /*
    57    * Make sure the timeout is in the future
    58    */
    59   if ( _Timespec_Less_than( abstime, &current_time ) ) {
    60     already_timedout = TRUE;
    61     difference.tv_sec  = 0;
    62     difference.tv_nsec = 0;
    63     timeout = 0;
    64   } else {
    65     _Timespec_Subtract( &current_time, abstime, &difference );
    66     timeout = _Timespec_To_ticks( &difference );
     54  switch ( _POSIX_Absolute_timeout_to_ticks(abstime, &ticks) ) {
     55    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     56      return EINVAL;
     57    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     58    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     59      already_timedout = TRUE;
     60      break;
     61    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     62      already_timedout = FALSE;
     63      break;
    6764  }
    6865
     
    7067    cond,
    7168    mutex,
    72     timeout,
     69    ticks,
    7370    already_timedout
    7471  );
  • cpukit/posix/src/mqueuereceive.c

    rd3c32136 r6a0898b  
    1212 *         time.
    1313 *
    14  *  COPYRIGHT (c) 1989-2007.
     14 *  COPYRIGHT (c) 1989-2008.
    1515 *  On-Line Applications Research Corporation (OAR).
    1616 *
     
    5959    msg_len,
    6060    msg_prio,
     61    TRUE,
    6162    THREAD_QUEUE_WAIT_FOREVER
    6263  );
  • cpukit/posix/src/mqueuerecvsupp.c

    rd3c32136 r6a0898b  
    1212 *         time.
    1313 *
    14  *  COPYRIGHT (c) 1989-2007.
     14 *  COPYRIGHT (c) 1989-2008.
    1515 *  On-Line Applications Research Corporation (OAR).
    1616 *
     
    4040#include <rtems/posix/time.h>
    4141
    42 /*PAGE
    43  *
     42/*
    4443 *  _POSIX_Message_queue_Receive_support
    4544 *
     
    5352  size_t              msg_len,
    5453  unsigned int       *msg_prio,
     54  boolean             wait,
    5555  Watchdog_Interval   timeout
    5656)
     
    6060  Objects_Locations                location;
    6161  size_t                           length_out;
     62  boolean                          do_wait;
    6263
    6364  the_mq_fd = _POSIX_Message_queue_Get_fd( mqdes, &location );
     
    8485      length_out = -1;
    8586
     87      /*
     88       *  A timed receive with a bad time will do a poll regardless.
     89       */
     90      if ( wait )
     91        do_wait = (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE;
     92      else
     93        do_wait = wait;
     94
     95      /*
     96       *  Now perform the actual message receive
     97       */
    8698      _CORE_message_queue_Seize(
    8799        &the_mq->Message_queue,
     
    89101        msg_ptr,
    90102        &length_out,
    91         (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE,
     103        do_wait,
    92104        timeout
    93105      );
  • cpukit/posix/src/mqueuesend.c

    rd3c32136 r6a0898b  
    1212 *         time.
    1313 *
    14  *  COPYRIGHT (c) 1989-2007.
     14 *  COPYRIGHT (c) 1989-2008.
    1515 *  On-Line Applications Research Corporation (OAR).
    1616 *
     
    5959    msg_len,
    6060    msg_prio,
     61    TRUE,
    6162    THREAD_QUEUE_WAIT_FOREVER
    6263  );
  • cpukit/posix/src/mqueuesendsupp.c

    rd3c32136 r6a0898b  
    1212 *         time.
    1313 *
    14  *  COPYRIGHT (c) 1989-2007.
     14 *  COPYRIGHT (c) 1989-2008.
    1515 *  On-Line Applications Research Corporation (OAR).
    1616 *
     
    5151  size_t              msg_len,
    5252  uint32_t            msg_prio,
     53  boolean             wait,
    5354  Watchdog_Interval   timeout
    5455)
     
    5859  Objects_Locations               location;
    5960  CORE_message_queue_Status       msg_status;
     61  boolean                         do_wait;
    6062
    6163  /*
     
    7880      the_mq = the_mq_fd->Queue;
    7981
     82      /*
     83       *  A timed receive with a bad time will do a poll regardless.
     84       */
     85      if ( wait )
     86        do_wait = (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE;
     87      else
     88        do_wait = wait;
     89
     90      /*
     91       *  Now perform the actual message receive
     92       */
    8093      msg_status = _CORE_message_queue_Submit(
    8194        &the_mq->Message_queue,
     
    8598        NULL,
    8699        _POSIX_Message_queue_Priority_to_core( msg_prio ),
    87          (the_mq_fd->oflag & O_NONBLOCK) ? FALSE : TRUE,
     100        do_wait,
    88101        timeout    /* no timeout */
    89102      );
  • cpukit/posix/src/mqueuetimedreceive.c

    rd3c32136 r6a0898b  
    1414
    1515/*
    16  *  COPYRIGHT (c) 1989-2007.
     16 *  COPYRIGHT (c) 1989-2008.
    1717 *  On-Line Applications Research Corporation (OAR).
    1818 *
     
    5454  size_t                 msg_len,
    5555  unsigned int          *msg_prio,
    56   const struct timespec *timeout
     56  const struct timespec *abstime
    5757)
    5858{
     59  Watchdog_Interval ticks;
     60  boolean           do_wait;
     61
     62  /*
     63   *  POSIX requires that blocking calls with timeouts that take
     64   *  an absolute timeout must ignore issues with the absolute
     65   *  time provided if the operation would otherwise succeed.
     66   *  So we check the abstime provided, and hold on to whether it
     67   *  is valid or not.  If it isn't correct and in the future,
     68   *  then we do a polling operation and convert the UNSATISFIED
     69   *  status into the appropriate error.
     70   */
     71  switch ( _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     72    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     73    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     74    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     75      do_wait = FALSE;
     76      break;
     77    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     78      do_wait = TRUE;
     79      break;
     80  }
     81
    5982  return _POSIX_Message_queue_Receive_support(
    6083    mqdes,
     
    6285    msg_len,
    6386    msg_prio,
    64     _Timespec_To_ticks( timeout )
     87    do_wait,
     88    ticks
    6589  );
    6690}
  • cpukit/posix/src/mqueuetimedsend.c

    rd3c32136 r6a0898b  
    1414
    1515/*
    16  *  COPYRIGHT (c) 1989-2007.
     16 *  COPYRIGHT (c) 1989-2008.
    1717 *  On-Line Applications Research Corporation (OAR).
    1818 *
     
    5454  size_t                 msg_len,
    5555  unsigned int           msg_prio,
    56   const struct timespec *timeout
     56  const struct timespec *abstime
    5757)
    5858{
     59  Watchdog_Interval ticks;
     60  boolean           do_wait;
     61
     62  /*
     63   *  POSIX requires that blocking calls with timeouts that take
     64   *  an absolute timeout must ignore issues with the absolute
     65   *  time provided if the operation would otherwise succeed.
     66   *  So we check the abstime provided, and hold on to whether it
     67   *  is valid or not.  If it isn't correct and in the future,
     68   *  then we do a polling operation and convert the UNSATISFIED
     69   *  status into the appropriate error.
     70   */
     71  switch ( _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
     72    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     73    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     74    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     75      do_wait = FALSE;
     76      break;
     77    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     78      do_wait = TRUE;
     79      break;
     80  }
     81
    5982  return _POSIX_Message_queue_Send_support(
    6083    mqdes,
     
    6285    msg_len,
    6386    msg_prio,
    64     _Timespec_To_ticks( timeout )
     87    do_wait,
     88    ticks
    6589  );
    6690}
  • cpukit/posix/src/mutextimedlock.c

    rd3c32136 r6a0898b  
    44
    55/*
    6  *  COPYRIGHT (c) 1989-2007.
     6 *  COPYRIGHT (c) 1989-2008.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    4040int pthread_mutex_timedlock(
    4141  pthread_mutex_t       *mutex,
    42   const struct timespec *timeout
     42  const struct timespec *abstime
    4343)
    4444{
    45   /* XXX does timeout need to be based on CLOCK_REALTIME and be TOD? */
    46   return _POSIX_Mutex_Lock_support(
     45  Watchdog_Interval                            ticks;
     46  boolean                                      do_wait;
     47  POSIX_Absolute_timeout_conversion_results_t  status;
     48  int                                          lock_status;
     49
     50  /*
     51   *  POSIX requires that blocking calls with timeouts that take
     52   *  an absolute timeout must ignore issues with the absolute
     53   *  time provided if the operation would otherwise succeed.
     54   *  So we check the abstime provided, and hold on to whether it
     55   *  is valid or not.  If it isn't correct and in the future,
     56   *  then we do a polling operation and convert the UNSATISFIED
     57   *  status into the appropriate error.
     58   */
     59  status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
     60  switch ( status ) {
     61    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     62    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     63    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     64      do_wait = FALSE;
     65      break;
     66    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     67      do_wait = TRUE;
     68      break;
     69  }
     70
     71  lock_status = _POSIX_Mutex_Lock_support(
    4772    mutex,
    48     TRUE,
    49     _Timespec_To_ticks( timeout )
     73    do_wait,
     74    ticks
    5075  );
     76
     77  /*
     78   *  This service only gives us the option to block.  We used a polling
     79   *  attempt to lock if the abstime was not in the future.  If we did
     80   *  not obtain the mutex, then not look at the status immediately,
     81   *  make sure the right reason is returned.
     82   */
     83  if ( !do_wait && (lock_status == EBUSY) ) {
     84    switch (lock_status) {
     85      case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     86        return EINVAL;
     87      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     88      case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     89        return ETIMEDOUT;
     90      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     91        break;
     92    }
     93  }
     94
     95  return lock_status;
    5196}
  • cpukit/posix/src/mutextranslatereturncode.c

    rd3c32136 r6a0898b  
    22 *  POSIX Mutex Error Translation
    33 *
    4  *  COPYRIGHT (c) 1989-2007.
     4 *  COPYRIGHT (c) 1989-2008.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
     
    3939  EPERM,                  /* CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE */
    4040  EINVAL,                 /* CORE_MUTEX_WAS_DELETED */
    41   EAGAIN,                 /* CORE_MUTEX_TIMEOUT */
     41  ETIMEDOUT,              /* CORE_MUTEX_TIMEOUT */
    4242  EINVAL                  /* CORE_MUTEX_STATUS_CEILING_VIOLATED */
    4343};
  • cpukit/posix/src/posixtimespecabsolutetimeout.c

    rd3c32136 r6a0898b  
    44
    55/*
    6  *  COPYRIGHT (c) 1989-2007.
     6 *  COPYRIGHT (c) 1989-2008.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    3535 *  The abstime is a walltime.  We turn it into an interval.
    3636 */
    37 int _POSIX_Absolute_timeout_to_ticks(
     37POSIX_Absolute_timeout_conversion_results_t _POSIX_Absolute_timeout_to_ticks(
    3838  const struct timespec *abstime,
    3939  Watchdog_Interval     *ticks_out
     
    4343  struct timespec difference;
    4444
     45 
     46  /*
     47   *  Make sure there is always a value returned.
     48   */
     49  *ticks_out = 0;
     50
     51  /*
     52   *  Is the absolute time even valid?
     53   */
    4554  if ( !_Timespec_Is_valid(abstime) )
    46     return EINVAL;
     55    return POSIX_ABSOLUTE_TIMEOUT_INVALID;
    4756
     57  /*
     58   *  Is the absolute time in the past?
     59   */
    4860  _TOD_Get( &current_time );
    4961
     62  if ( _Timespec_Less_than( abstime, &current_time ) )
     63    return POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST;
     64
    5065  /*
    51    *  Make sure the abstime is in the future
     66   *  How long until the requested absolute time?
    5267   */
    53   if ( _Timespec_Less_than( abstime, &current_time ) )
    54     return EINVAL;
    55 
    5668  _Timespec_Subtract( &current_time, abstime, &difference );
    5769
     70  /*
     71   *  Internally the SuperCore uses ticks, so convert to them.
     72   */
    5873  *ticks_out = _Timespec_To_ticks( &difference );
    5974
    60   return 0;
     75  /*
     76   *  If the difference was 0, then the future is now.  It is so bright
     77   *  we better wear shades.
     78   */
     79  if ( !*ticks_out )
     80    return POSIX_ABSOLUTE_TIMEOUT_IS_NOW;
     81
     82  /*
     83   *  This is the case we were expecting and it took this long to
     84   *  get here.
     85   */
     86  return POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE;
    6187}
    6288
  • cpukit/posix/src/prwlocktimedrdlock.c

    rd3c32136 r6a0898b  
    22 *  POSIX RWLock Manager -- Attempt to Obtain a Read Lock on a RWLock Instance
    33 *
    4  *  COPYRIGHT (c) 1989-2007.
     4 *  COPYRIGHT (c) 1989-2008.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
     
    4141)
    4242{
    43   POSIX_RWLock_Control  *the_rwlock;
    44   Objects_Locations      location;
    45   Watchdog_Interval      ticks;
    46   int                    status;
     43  POSIX_RWLock_Control                        *the_rwlock;
     44  Objects_Locations                            location;
     45  Watchdog_Interval                            ticks;
     46  boolean                                      do_wait;
     47  POSIX_Absolute_timeout_conversion_results_t  status;
    4748 
    4849  if ( !rwlock )
    4950    return EINVAL;
    5051
     52  /*
     53   *  POSIX requires that blocking calls with timeouts that take
     54   *  an absolute timeout must ignore issues with the absolute
     55   *  time provided if the operation would otherwise succeed.
     56   *  So we check the abstime provided, and hold on to whether it
     57   *  is valid or not.  If it isn't correct and in the future,
     58   *  then we do a polling operation and convert the UNSATISFIED
     59   *  status into the appropriate error.
     60   */
    5161  status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
    52   if ( status )
    53     return status;
     62  switch (status) {
     63    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     64    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     65    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     66      do_wait = FALSE;
     67      break;
     68    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     69      do_wait = TRUE;
     70      break;
     71  }
    5472
    5573  the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
     
    6179        &the_rwlock->RWLock,
    6280        *rwlock,
    63         TRUE,                   // we are willing to wait up to ticks
     81        do_wait,
    6482        ticks,
    6583        NULL
     
    6785
    6886      _Thread_Enable_dispatch();
     87      if ( !do_wait &&
     88           (_Thread_Executing->Wait.return_code == CORE_RWLOCK_UNAVAILABLE) ) {
     89        switch (status) {
     90          case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     91            return EINVAL;
     92          case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     93          case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     94            return ETIMEDOUT;
     95          case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     96            break;
     97        }
     98      }
     99
    69100      return _POSIX_RWLock_Translate_core_RWLock_return_code(
    70101        (CORE_RWLock_Status) _Thread_Executing->Wait.return_code
  • cpukit/posix/src/prwlocktimedwrlock.c

    rd3c32136 r6a0898b  
    22 *  POSIX RWLock Manager -- Attempt to Obtain a Write Lock on a RWLock Instance
    33 *
    4  *  COPYRIGHT (c) 1989-2007.
     4 *  COPYRIGHT (c) 1989-2008.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
     
    4141)
    4242{
    43   POSIX_RWLock_Control  *the_rwlock;
    44   Objects_Locations      location;
    45   int                    status;
    46   Watchdog_Interval      ticks;
    47 
     43  POSIX_RWLock_Control                        *the_rwlock;
     44  Objects_Locations                            location;
     45  Watchdog_Interval                            ticks;
     46  boolean                                      do_wait;
     47  POSIX_Absolute_timeout_conversion_results_t  status;
     48 
    4849  if ( !rwlock )
    4950    return EINVAL;
    5051
     52  /*
     53   *  POSIX requires that blocking calls with timeouts that take
     54   *  an absolute timeout must ignore issues with the absolute
     55   *  time provided if the operation would otherwise succeed.
     56   *  So we check the abstime provided, and hold on to whether it
     57   *  is valid or not.  If it isn't correct and in the future,
     58   *  then we do a polling operation and convert the UNSATISFIED
     59   *  status into the appropriate error.
     60   */
    5161  status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
    52   if ( status )
    53     return status;
     62  switch (status) {
     63    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     64    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     65    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     66      do_wait = FALSE;
     67      break;
     68    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     69      do_wait = TRUE;
     70      break;
     71  }
    5472
    5573  the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
     
    6179        &the_rwlock->RWLock,
    6280        *rwlock,
    63         TRUE,                 // we are willing to wait up to ticks
     81        do_wait,
    6482        ticks,
    6583        NULL
     
    6785
    6886      _Thread_Enable_dispatch();
     87      if ( !do_wait &&
     88           (_Thread_Executing->Wait.return_code == CORE_RWLOCK_UNAVAILABLE) ) {
     89        switch (status) {
     90          case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     91            return EINVAL;
     92          case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     93          case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     94            return ETIMEDOUT;
     95          case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     96            break;
     97        }
     98      }
     99
    69100      return _POSIX_RWLock_Translate_core_RWLock_return_code(
    70101        (CORE_RWLock_Status) _Thread_Executing->Wait.return_code
  • cpukit/posix/src/semaphoretranslatereturncode.c

    rd3c32136 r6a0898b  
    4242   */
    4343  ENOSYS,              /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
    44   EINVAL               /* CORE_SEMAPHORE_BAD_TIMEOUT_VALUE */
    4544};
    4645
  • cpukit/posix/src/semaphorewaitsupp.c

    rd3c32136 r6a0898b  
    11/*
    2  *  COPYRIGHT (c) 1989-2007.
     2 *  COPYRIGHT (c) 1989-2008.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    3434
    3535int _POSIX_Semaphore_Wait_support(
    36   sem_t                          *sem,
    37   Core_semaphore_Blocking_option  blocking,
    38   Watchdog_Interval               timeout
     36  sem_t             *sem,
     37  boolean            blocking,
     38  Watchdog_Interval  timeout
    3939)
    4040{
  • cpukit/posix/src/semtimedwait.c

    rd3c32136 r6a0898b  
    11/*
    2  *  COPYRIGHT (c) 1989-2007.
     2 *  COPYRIGHT (c) 1989-2008.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    4040)
    4141{
    42   /*
    43    *  The abstime is a walltime.  We turn it into an interval.
    44    */
    45   Watchdog_Interval              ticks = 0;
    46   struct timespec                current_time;
    47   struct timespec                difference;
    48   Core_semaphore_Blocking_option blocking = CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT;
     42  Watchdog_Interval                            ticks;
     43  boolean                                      do_wait = TRUE;
     44  POSIX_Absolute_timeout_conversion_results_t  status;
     45  int                                          lock_status;
    4946
    5047  /*
    51    *  Error check the absolute time to timeout
     48   *  POSIX requires that blocking calls with timeouts that take
     49   *  an absolute timeout must ignore issues with the absolute
     50   *  time provided if the operation would otherwise succeed.
     51   *  So we check the abstime provided, and hold on to whether it
     52   *  is valid or not.  If it isn't correct and in the future,
     53   *  then we do a polling operation and convert the UNSATISFIED
     54   *  status into the appropriate error.
    5255   */
    53   if ( !_Timespec_Is_valid( abstime ) ) {
    54     blocking = CORE_SEMAPHORE_BAD_TIMEOUT_VALUE;
    55   } else {
    56     _TOD_Get( &current_time );
    57     /*
    58      *  Make sure the abstime is in the future
    59      */
    60     if ( _Timespec_Less_than( abstime, &current_time ) ) {
    61       blocking = CORE_SEMAPHORE_BAD_TIMEOUT;
    62     } else {
    63       _Timespec_Subtract( &current_time, abstime, &difference );
    64       ticks = _Timespec_To_ticks( &difference );
    65       blocking = CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT;
     56  status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
     57  switch ( status ) {
     58    case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     59    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     60    case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     61      do_wait = FALSE;
     62      break;
     63    case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     64      do_wait = TRUE;
     65      break;
     66  }
     67
     68  lock_status = _POSIX_Semaphore_Wait_support( sem, do_wait, ticks );
     69
     70  /*
     71   *  This service only gives us the option to block.  We used a polling
     72   *  attempt to obtain if the abstime was not in the future.  If we did
     73   *  not obtain the semaphore, then not look at the status immediately,
     74   *  make sure the right reason is returned.
     75   */
     76  if ( !do_wait && (lock_status == EBUSY) ) {
     77    switch (lock_status) {
     78      case POSIX_ABSOLUTE_TIMEOUT_INVALID:
     79        return EINVAL;
     80      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
     81      case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
     82        return ETIMEDOUT;
     83      case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
     84        break;
    6685    }
    67    }
     86  }
    6887
    69    return _POSIX_Semaphore_Wait_support( sem, blocking, ticks );
     88  return lock_status;
    7089}
  • cpukit/posix/src/semtrywait.c

    rd3c32136 r6a0898b  
    11/*
    2  *  COPYRIGHT (c) 1989-2007.
     2 *  COPYRIGHT (c) 1989-2008.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    3939)
    4040{
    41   return _POSIX_Semaphore_Wait_support( sem, FALSE, THREAD_QUEUE_WAIT_FOREVER );
     41  return _POSIX_Semaphore_Wait_support(sem, FALSE, THREAD_QUEUE_WAIT_FOREVER);
    4242}
  • cpukit/posix/src/semwait.c

    rd3c32136 r6a0898b  
    11/*
    2  *  COPYRIGHT (c) 1989-2007.
     2 *  COPYRIGHT (c) 1989-2008.
    33 *  On-Line Applications Research Corporation (OAR).
    44 *
     
    3939)
    4040{
    41   return _POSIX_Semaphore_Wait_support(
    42            sem,
    43            CORE_SEMAPHORE_BLOCK_FOREVER,
    44            THREAD_QUEUE_WAIT_FOREVER
    45          );
     41  return _POSIX_Semaphore_Wait_support( sem, TRUE, THREAD_QUEUE_WAIT_FOREVER );
    4642}
  • cpukit/posix/src/sigtimedwait.c

    rd3c32136 r6a0898b  
    22 *  3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
    33 *
    4  *  COPYRIGHT (c) 1989-2007.
     4 *  COPYRIGHT (c) 1989-2008.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
     
    6464  /*
    6565   *  Error check parameters before disabling interrupts.
     66   *
     67   *  NOTE: This is very specifically a RELATIVE not ABSOLUTE time
     68   *        in the Open Group specification.
    6669   */
    6770
     
    6972  if ( timeout ) {
    7073
    71     if ( !_Timespec_Is_valid( timeout ) ) {
     74    if ( !_Timespec_Is_valid( timeout ) )
    7275      rtems_set_errno_and_return_minus_one( EINVAL );
    73     }
    7476
    7577    interval = _Timespec_To_ticks( timeout );
     78
     79    if ( !interval )
     80      rtems_set_errno_and_return_minus_one( EINVAL );
    7681  }
    7782
  • cpukit/posix/src/timersettime.c

    rd3c32136 r6a0898b  
    6060    if ( _Timespec_Greater_than( &normalize.it_value, &_TOD_Now ) )
    6161      rtems_set_errno_and_return_minus_one( EINVAL );
    62     _Timespec_Subtract( &_TOD_Now, &normalize.it_value, &normalize.it_value);
     62    _Timespec_Subtract( &_TOD_Now, &normalize.it_value, &normalize.it_value );
    6363  }
     64
    6465  /* If the function reaches this point, then it will be necessary to do
    6566   * something with the structure of times of the timer: to stop, start
  • cpukit/posix/src/ualarm.c

    rd3c32136 r6a0898b  
    22 *  3.4.1 Schedule Alarm, P1003.1b-1993, p. 79
    33 *
    4  *  COPYRIGHT (c) 1989-2007.
     4 *  COPYRIGHT (c) 1989-2008.
    55 *  On-Line Applications Research Corporation (OAR).
    66 *
     
    102102    tp.tv_nsec = (useconds % TOD_MICROSECONDS_PER_SECOND) * 1000;
    103103    ticks = _Timespec_To_ticks( &tp );
    104 
    105104    if ( ticks == 0 )
    106105      ticks = 1;
     106
    107107    _Watchdog_Insert_ticks( the_timer, _Timespec_To_ticks( &tp ) );
    108108  }
  • cpukit/rtems/src/semobtain.c

    rd3c32136 r6a0898b  
    1616 *     + release a semaphore
    1717 *
    18  *  COPYRIGHT (c) 1989-2007.
     18 *  COPYRIGHT (c) 1989-2008.
    1919 *  On-Line Applications Research Corporation (OAR).
    2020 *
     
    9696        &the_semaphore->Core_control.semaphore,
    9797        id,
    98         ((_Options_Is_no_wait( option_set )) ?
    99           CORE_SEMAPHORE_NO_WAIT : CORE_SEMAPHORE_BLOCK_FOREVER),
     98        ((_Options_Is_no_wait( option_set )) ? FALSE : TRUE),
    10099        timeout,
    101100        &level
  • cpukit/rtems/src/semtranslatereturncode.c

    rd3c32136 r6a0898b  
    116116  RTEMS_TIMEOUT,            /* CORE_SEMAPHORE_TIMEOUT  */
    117117  RTEMS_INTERNAL_ERROR,     /* CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED */
    118   RTEMS_INTERNAL_ERROR      /* CORE_SEMAPHORE_BAD_TIMEOUT_VALUE */
    119118};
    120119
  • cpukit/score/include/rtems/score/coremutex.h

    rd3c32136 r6a0898b  
    4141#include <rtems/score/interr.h>
    4242#include <rtems/score/sysstate.h>
    43 
    4443
    4544/**
     
    412411     _CORE_mutex_Seize_body( _the_mutex, _id, _wait, _timeout, _level )
    413412#endif
     413
    414414/**
    415415 *  @brief Surrender the Mutex
  • cpukit/score/include/rtems/score/coresem.h

    rd3c32136 r6a0898b  
    99
    1010/*
    11  *  COPYRIGHT (c) 1989-2007.
     11 *  COPYRIGHT (c) 1989-2008.
    1212 *  On-Line Applications Research Corporation (OAR).
    1313 *
     
    8383   *  and this would have made its count greater than that allowed.
    8484   */
    85   CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED,
    86   /** This status indicates that the semaphore was not immediately
    87    *  available and the caller passed a bad timeout value to the API
    88    *  routine.  In this case, the API required that the validity check
    89    *  for the timeout occur after the check that the semaphore was immediately
    90    *  available.
    91    */
    92   CORE_SEMAPHORE_BAD_TIMEOUT_VALUE
     85  CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
    9386}   CORE_semaphore_Status;
    9487
     
    9891 *  This is the last status value.
    9992 */
    100 #define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_BAD_TIMEOUT_VALUE
     93#define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
    10194
    10295/**
     
    131124
    132125/**
    133  *  The following enumerated type is the set of blocking options
    134  *  available to seize operation.
    135  */
    136 typedef enum {
    137   /** This value indicates that the caller does not wish to block. */
    138   CORE_SEMAPHORE_NO_WAIT,
    139   /** This value indicates that the caller is willing to block forever. */
    140   CORE_SEMAPHORE_BLOCK_FOREVER,
    141   /** This value indicates that the caller is blocking with a timeout. */
    142   CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT,
    143   /** This value indicates that the caller wanted to block but passed in
    144    *  a bad timeout value to the API. Unfortunately, this is a weird case
    145    *  where the timeout bad error is required to be generated only if
    146    *  the semaphore is not available.
    147    */
    148   CORE_SEMAPHORE_BAD_TIMEOUT
    149 } Core_semaphore_Blocking_option;
    150 
    151 /**
    152126 *  This routine initializes the semaphore based on the parameters passed.
    153127 *
     
    171145 *  @param[in] id is the Id of the API level Semaphore object associated
    172146 *         with this instance of a SuperCore Semaphore
    173  *  @param[in] wait is the blocking mode
     147 *  @param[in] wait indicates if the caller is willing to block
    174148 *  @param[in] timeout is the number of ticks the calling thread is willing
    175149 *         to wait if @a wait is TRUE.
    176150 */
    177151void _CORE_semaphore_Seize(
    178   CORE_semaphore_Control         *the_semaphore,
    179   Objects_Id                      id,
    180   Core_semaphore_Blocking_option  wait,
    181   Watchdog_Interval               timeout
     152  CORE_semaphore_Control  *the_semaphore,
     153  Objects_Id               id,
     154  boolean                  wait,
     155  Watchdog_Interval        timeout
    182156);
    183157
  • cpukit/score/src/coresemseize.c

    rd3c32136 r6a0898b  
    5252
    5353void _CORE_semaphore_Seize(
    54   CORE_semaphore_Control         *the_semaphore,
    55   Objects_Id                      id,
    56   Core_semaphore_Blocking_option  wait,
    57   Watchdog_Interval               timeout
     54  CORE_semaphore_Control *the_semaphore,
     55  Objects_Id              id,
     56  boolean                 wait,
     57  Watchdog_Interval       timeout
    5858)
    5959{
     
    7575   *  the semaphore was not available and the caller never blocked.
    7676   */
    77   if ( wait == CORE_SEMAPHORE_NO_WAIT ) {
    78       _ISR_Enable( level );
    79       executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
    80       return;
    81   }
    82 
    83   /*
    84    *  This is strange case because normally RTEMS validates parameters
    85    *  before performing any real work.  But in this case, the POSIX
    86    *  API requires that a semaphore be checked for immediate availability
    87    *  BEFORE the timeout value is validated.  This is implemented in
    88    *  RTEMS by indicating a special status that the timeout value
    89    *  was invalid which is returned in this case.
    90    */
    91   if ( wait == CORE_SEMAPHORE_BAD_TIMEOUT ) {
    92       _ISR_Enable( level );
    93       executing->Wait.return_code = CORE_SEMAPHORE_BAD_TIMEOUT_VALUE;
    94       return;
     77  if ( !wait ) {
     78    _ISR_Enable( level );
     79    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
     80    return;
    9581  }
    9682
     
    9985   *  block, then we now block the caller with optional timeout.
    10086   */
    101   if (( wait == CORE_SEMAPHORE_BLOCK_FOREVER) ||
    102       ( wait == CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT ) ) {
    103       _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue );
    104       executing->Wait.queue          = &the_semaphore->Wait_queue;
    105       executing->Wait.id             = id;
    106       _ISR_Enable( level );
    107       _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
    108   }
     87  _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue );
     88  executing->Wait.queue = &the_semaphore->Wait_queue;
     89  executing->Wait.id    = id;
     90  _ISR_Enable( level );
     91  _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
    10992}
Note: See TracChangeset for help on using the changeset viewer.