Changeset 73a4bab in mainline for arch/mips32


Ignore:
Timestamp:
2005-11-11T14:06:55Z (20 years ago)
Author:
Jakub Vana <jakub.vana@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8a0b3730
Parents:
0172eba
Message:

Atomic inc & dec functions synchronized on all ia32,ia64 and mips platforms. Now there are 3 versions which returns no value, new value and old value och changed variable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/mips32/include/atomic.h

    r0172eba r73a4bab  
    3535#define atomic_dec(x)   (a_sub(x,1))
    3636
     37#define atomic_inc_pre(x) (a_add(x,1)-1)
     38#define atomic_dec_pre(x) (a_sub(x,1)+1)
     39
     40#define atomic_inc_post(x) (a_add(x,1))
     41#define atomic_dec_post(x) (a_sub(x,1))
     42
     43
    3744typedef volatile __u32 atomic_t;
    3845
     
    4552 * of the variable to a special register and if another process writes to
    4653 * the same location, the SC (store-conditional) instruction fails.
     54 
     55 Returns (*val)+i
     56 
    4757 */
    4858static inline atomic_t a_add(atomic_t *val, int i)
     
    7383 *
    7484 * Implemented in the same manner as a_add, except we substract the value.
     85
     86 Returns (*val)-i
     87
    7588 */
    7689static inline atomic_t a_sub(atomic_t *val, int i)
Note: See TracChangeset for help on using the changeset viewer.