Changeset 80bcaed in mainline for kernel/generic/include/synch


Ignore:
Timestamp:
2007-02-03T13:22:24Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f619ec11
Parents:
fa8e7d2
Message:

Merge as_t structure into one and leave the differring parts in as_genarch_t.

Indentation and formatting changes in header files.

Location:
kernel/generic/include/synch
Files:
6 edited

Legend:

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

    rfa8e7d2 r80bcaed  
    4545} condvar_t;
    4646
    47 #define condvar_wait(cv,mtx) \
    48         _condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
    49 #define condvar_wait_timeout(cv,mtx,usec) \
    50         _condvar_wait_timeout((cv),(mtx),(usec),SYNCH_FLAGS_NONE)
     47#define condvar_wait(cv, mtx) \
     48        _condvar_wait_timeout((cv), (mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
     49#define condvar_wait_timeout(cv, mtx, usec) \
     50        _condvar_wait_timeout((cv), (mtx), (usec), SYNCH_FLAGS_NONE)
    5151
    5252extern void condvar_initialize(condvar_t *cv);
    5353extern void condvar_signal(condvar_t *cv);
    5454extern void condvar_broadcast(condvar_t *cv);
    55 extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, uint32_t usec, int flags);
     55extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, uint32_t usec,
     56    int flags);
    5657
    5758#endif
  • kernel/generic/include/synch/futex.h

    rfa8e7d2 r80bcaed  
    4343/** Kernel-side futex structure. */
    4444typedef struct {
    45         uintptr_t paddr;        /**< Physical address of the status variable. */
    46         waitq_t wq;             /**< Wait queue for threads waiting for futex availability. */
    47         link_t ht_link;         /**< Futex hash table link. */
    48         count_t refcount;       /**< Number of tasks that reference this futex. */
     45        /** Physical address of the status variable. */
     46        uintptr_t paddr;
     47        /** Wait queue for threads waiting for futex availability. */
     48        waitq_t wq;
     49        /** Futex hash table link. */
     50        link_t ht_link;
     51        /** Number of tasks that reference this futex. */
     52        count_t refcount;
    4953} futex_t;
    5054
    5155extern void futex_init(void);
    52 extern unative_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags);
     56extern unative_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec,
     57    int flags);
    5358extern unative_t sys_futex_wakeup(uintptr_t uaddr);
    5459
  • kernel/generic/include/synch/rwlock.h

    rfa8e7d2 r80bcaed  
    4949typedef struct {
    5050        SPINLOCK_DECLARE(lock);
    51         mutex_t exclusive;      /**< Mutex for writers, readers can bypass it if readers_in is positive. */
    52         count_t readers_in;     /**< Number of readers in critical section. */
     51        /**
     52         * Mutex for writers, readers can bypass it if readers_in is positive.
     53         */
     54        mutex_t exclusive;
     55        /** Number of readers in critical section. */
     56        count_t readers_in;
    5357} rwlock_t;
    5458
    5559#define rwlock_write_lock(rwl) \
    56         _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
     60        _rwlock_write_lock_timeout((rwl), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
    5761#define rwlock_read_lock(rwl) \
    58         _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)
     62        _rwlock_read_lock_timeout((rwl), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
    5963#define rwlock_write_trylock(rwl) \
    60         _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
     64        _rwlock_write_lock_timeout((rwl), SYNCH_NO_TIMEOUT, \
     65            SYNCH_FLAGS_NON_BLOCKING)
    6166#define rwlock_read_trylock(rwl) \
    62         _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING)
    63 #define rwlock_write_lock_timeout(rwl,usec) \
    64         _rwlock_write_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
    65 #define rwlock_read_lock_timeout(rwl,usec) \
    66         _rwlock_read_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE)
     67        _rwlock_read_lock_timeout((rwl), SYNCH_NO_TIMEOUT, \
     68            SYNCH_FLAGS_NON_BLOCKING)
     69#define rwlock_write_lock_timeout(rwl, usec) \
     70        _rwlock_write_lock_timeout((rwl), (usec), SYNCH_FLAGS_NONE)
     71#define rwlock_read_lock_timeout(rwl, usec) \
     72        _rwlock_read_lock_timeout((rwl), (usec), SYNCH_FLAGS_NONE)
    6773
    6874extern void rwlock_initialize(rwlock_t *rwl);
  • kernel/generic/include/synch/semaphore.h

    rfa8e7d2 r80bcaed  
    4747        _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
    4848#define semaphore_trydown(s) \
    49         _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING)       
     49        _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING)
    5050#define semaphore_down_timeout(s, usec) \
    5151        _semaphore_down_timeout((s), (usec), SYNCH_FLAGS_NONE)
  • kernel/generic/include/synch/synch.h

    rfa8e7d2 r80bcaed  
    3636#define KERN_SYNCH_H_
    3737
    38 #define SYNCH_NO_TIMEOUT        0       /**< Request with no timeout. */
     38/** Request with no timeout. */
     39#define SYNCH_NO_TIMEOUT        0
    3940
    40 #define SYNCH_FLAGS_NONE                0       /**< No flags specified. */
    41 #define SYNCH_FLAGS_NON_BLOCKING        (1<<0)  /**< Non-blocking operation request. */
    42 #define SYNCH_FLAGS_INTERRUPTIBLE       (1<<1)  /**< Interruptible operation. */
     41/** No flags specified. */
     42#define SYNCH_FLAGS_NONE                0
     43/** Non-blocking operation request. */
     44#define SYNCH_FLAGS_NON_BLOCKING        (1 << 0)
     45/** Interruptible operation. */
     46#define SYNCH_FLAGS_INTERRUPTIBLE       (1 << 1)
    4347
    44 #define ESYNCH_WOULD_BLOCK      1       /**< Could not satisfy the request without going to sleep. */
    45 #define ESYNCH_TIMEOUT          2       /**< Timeout occurred. */
    46 #define ESYNCH_INTERRUPTED      4       /**< Sleep was interrupted. */
    47 #define ESYNCH_OK_ATOMIC        8       /**< Operation succeeded without sleeping. */
    48 #define ESYNCH_OK_BLOCKED       16      /**< Operation succeeded and did sleep. */
     48/** Could not satisfy the request without going to sleep. */
     49#define ESYNCH_WOULD_BLOCK      1
     50/** Timeout occurred. */
     51#define ESYNCH_TIMEOUT          2
     52/** Sleep was interrupted. */
     53#define ESYNCH_INTERRUPTED      4
     54/** Operation succeeded without sleeping. */
     55#define ESYNCH_OK_ATOMIC        8
     56/** Operation succeeded and did sleep. */
     57#define ESYNCH_OK_BLOCKED       16
    4958
    50 #define SYNCH_FAILED(rc)        ((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT | ESYNCH_INTERRUPTED))
    51 #define SYNCH_OK(rc)            ((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED))
     59#define SYNCH_FAILED(rc) \
     60        ((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT | ESYNCH_INTERRUPTED))
     61#define SYNCH_OK(rc) \
     62        ((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED))
    5263
    5364#endif
  • kernel/generic/include/synch/waitq.h

    rfa8e7d2 r80bcaed  
    5353        SPINLOCK_DECLARE(lock);
    5454
    55         int missed_wakeups;     /**< Number of waitq_wakeup() calls that didn't find a thread to wake up. */
    56         link_t head;            /**< List of sleeping threads for wich there was no missed_wakeup. */
     55        /**
     56         * Number of waitq_wakeup() calls that didn't find a thread to wake up.
     57         */
     58        int missed_wakeups;
     59        /** List of sleeping threads for wich there was no missed_wakeup. */
     60        link_t head;
    5761} waitq_t;
    5862
Note: See TracChangeset for help on using the changeset viewer.