Changeset baafe71 in mainline


Ignore:
Timestamp:
2006-05-25T10:04:05Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fd4d8c0
Parents:
47800e0
Message:

Make implementation of condition variables compliant with their definition.
Signal operation must become a no-op if there is no thread in the wait operation.
Remove condvar_trywait() which has no meaning after this change.

Location:
generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • generic/include/synch/condvar.h

    r47800e0 rbaafe71  
    4040
    4141#define condvar_wait(cv,mtx) \
    42         _condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
    43 #define condvar_trywait(cv,mtx) \
    44         _condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
     42        _condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT)
    4543#define condvar_wait_timeout(cv,mtx,usec) \
    46         _condvar_wait_timeout((cv),(mtx),(usec),SYNCH_NON_BLOCKING)
     44        _condvar_wait_timeout((cv),(mtx),(usec))
    4745
    4846extern void condvar_initialize(condvar_t *cv);
    4947extern void condvar_signal(condvar_t *cv);
    5048extern void condvar_broadcast(condvar_t *cv);
    51 extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait);
     49extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec);
    5250
    5351#endif
  • generic/src/synch/condvar.c

    r47800e0 rbaafe71  
    7575 * @param mtx Mutex.
    7676 * @param usec Timeout value in microseconds.
    77  * @param trywait Blocking versus non-blocking operation mode switch.
    7877 *
    79  * For exact description of possible combinations of
    80  * usec and trywait, see comment for waitq_sleep_timeout().
     78 * For exact description of meaning of possible values of usec,
     79 * see comment for waitq_sleep_timeout().
    8180 *
    8281 * @return See comment for waitq_sleep_timeout().
    8382 */
    84 int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait)
     83int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec)
    8584{
    8685        int rc;
     
    8988        ipl = waitq_sleep_prepare(&cv->wq);
    9089        mutex_unlock(mtx);
    91        
    92         rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, trywait);
     90
     91        cv->wq.missed_wakeups = 0;      /* Enforce blocking. */
     92        rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, SYNCH_BLOCKING);
    9393
    9494        mutex_lock(mtx);
Note: See TracChangeset for help on using the changeset viewer.