Changeset 23684b7 in mainline for arch/ia32/include/atomic.h


Ignore:
Timestamp:
2006-03-22T17:21:15Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d71007e
Parents:
45fb65c
Message:

Define atomic_t only once in atomic.h
Change the encapsulated counter type to long so that it supports negative values as well.

File:
1 edited

Legend:

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

    r45fb65c r23684b7  
    3333#include <arch/barrier.h>
    3434#include <preemption.h>
    35 
    36 typedef struct { volatile __u32 count; } atomic_t;
    37 
    38 static inline void atomic_set(atomic_t *val, __u32 i)
    39 {
    40         val->count = i;
    41 }
    42 
    43 static inline __u32 atomic_get(atomic_t *val)
    44 {
    45         return val->count;
    46 }
     35#include <typedefs.h>
    4736
    4837static inline void atomic_inc(atomic_t *val) {
     
    6251}
    6352
    64 static inline count_t atomic_postinc(atomic_t *val)
     53static inline long atomic_postinc(atomic_t *val)
    6554{
    66         count_t r;
     55        long r;
    6756
    6857        __asm__ volatile (
     
    7564}
    7665
    77 static inline count_t atomic_postdec(atomic_t *val)
     66static inline long atomic_postdec(atomic_t *val)
    7867{
    79         count_t r;
     68        long r;
    8069       
    8170        __asm__ volatile (
     
    10392}
    10493
    105 /** Ia32 specific fast spinlock */
     94/** ia32 specific fast spinlock */
    10695static inline void atomic_lock_arch(atomic_t *val)
    10796{
     
    116105                "mov %0, %1;"
    117106                "testl %1, %1;"
    118                 "jnz 0b;"       /* Leightweight looping on locked spinlock */
     107                "jnz 0b;"       /* Lightweight looping on locked spinlock */
    119108               
    120109                "incl %1;"      /* now use the atomic operation */
Note: See TracChangeset for help on using the changeset viewer.