Changeset c0bc189 in mainline for generic/src/synch/condvar.c


Ignore:
Timestamp:
2006-05-19T11:55:55Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7633b109
Parents:
35f3b8c
Message:

Fix race in condition variables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/synch/condvar.c

    r35f3b8c rc0bc189  
    3636#include <synch/waitq.h>
    3737#include <synch/synch.h>
     38#include <arch.h>
     39#include <typedefs.h>
    3840
    39 /** Initialize condition variable
    40  *
    41  * Initialize condition variable.
     41/** Initialize condition variable.
    4242 *
    4343 * @param cv Condition variable.
     
    4848}
    4949
    50 /** Signal the condition has become true
    51  *
     50/**
    5251 * Signal the condition has become true
    5352 * to the first waiting thread by waking it up.
     
    6059}
    6160
    62 /** Signal the condition has become true
    63  *
     61/**
    6462 * Signal the condition has become true
    6563 * to all waiting threads by waking them up.
     
    7270}
    7371
    74 /** Wait for the condition becoming true
    75  *
    76  * Wait for the condition becoming true.
     72/** Wait for the condition becoming true.
    7773 *
    7874 * @param cv Condition variable.
     
    8985{
    9086        int rc;
     87        ipl_t ipl;
    9188
     89        ipl = waitq_sleep_prepare(&cv->wq);
    9290        mutex_unlock(mtx);
    93         rc = waitq_sleep_timeout(&cv->wq, usec, trywait);
     91       
     92        rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, trywait);
     93
    9494        mutex_lock(mtx);
     95        waitq_sleep_finish(&cv->wq, rc, ipl);
     96
    9597        return rc;
    9698}
Note: See TracChangeset for help on using the changeset viewer.