Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset e15e0e8 in mainline


Ignore:
Timestamp:
2009-12-02T22:29:46Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
8d04f709
Parents:
4702bde
Message:

Make provisions for different implementations of atomic_t.
This breaks arm32.

Location:
uspace/lib/libc
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/arch/amd64/include/atomic.h

    r4702bde re15e0e8  
    3737#ifndef LIBC_amd64_ATOMIC_H_
    3838#define LIBC_amd64_ATOMIC_H_
     39
     40#define LIBC_ARCH_ATOMIC_H_
     41
     42#include <atomicdflt.h>
    3943
    4044static inline void atomic_inc(atomic_t *val) {
  • uspace/lib/libc/arch/ia32/include/atomic.h

    r4702bde re15e0e8  
    3535#ifndef LIBC_ia32_ATOMIC_H_
    3636#define LIBC_ia32_ATOMIC_H_
     37
     38#define LIBC_ARCH_ATOMIC_H_
     39
     40#include <atomicdflt.h>
    3741
    3842static inline void atomic_inc(atomic_t *val) {
  • uspace/lib/libc/arch/ia64/include/atomic.h

    r4702bde re15e0e8  
    3535#ifndef LIBC_ia64_ATOMIC_H_
    3636#define LIBC_ia64_ATOMIC_H_
     37
     38#define LIBC_ARCH_ATOMIC_H_
     39
     40#include <atomicdflt.h>
    3741
    3842static inline void atomic_inc(atomic_t *val)
  • uspace/lib/libc/arch/mips32/include/atomic.h

    r4702bde re15e0e8  
    3636#ifndef LIBC_mips32_ATOMIC_H_
    3737#define LIBC_mips32_ATOMIC_H_
     38
     39#define LIBC_ARCH_ATOMIC_H_
     40
     41#include <atomicdflt.h>
    3842
    3943#define atomic_inc(x)   ((void) atomic_add(x, 1))
  • uspace/lib/libc/arch/ppc32/include/atomic.h

    r4702bde re15e0e8  
    3535#ifndef LIBC_ppc32_ATOMIC_H_
    3636#define LIBC_ppc32_ATOMIC_H_
     37
     38#define LIBC_ARCH_ATOMIC_H_
     39
     40#include <atomicdflt.h>
    3741
    3842static inline void atomic_inc(atomic_t *val)
  • uspace/lib/libc/arch/sparc64/include/atomic.h

    r4702bde re15e0e8  
    3636#define LIBC_sparc64_ATOMIC_H_
    3737
     38#define LIBC_ARCH_ATOMIC_H_
     39
     40#include <atomicdflt.h>
    3841#include <sys/types.h>
    3942
  • uspace/lib/libc/include/atomic.h

    r4702bde re15e0e8  
    11/*
    2  * Copyright (c) 2006 Jakub Jermar
     2 * Copyright (c) 2009 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    3636#define LIBC_ATOMIC_H_
    3737
    38 #include <bool.h>
    39 
    40 typedef struct atomic {
    41         volatile long count;
    42 } atomic_t;
    43 
    4438#include <libarch/atomic.h>
    45 
    46 static inline void atomic_set(atomic_t *val, long i)
    47 {
    48         val->count = i;
    49 }
    50 
    51 static inline long atomic_get(atomic_t *val)
    52 {
    53         return val->count;
    54 }
    55 
    56 static inline bool cas(atomic_t *val, long ov, long nv)
    57 {
    58         return __sync_bool_compare_and_swap(&val->count, ov, nv);
    59 }
    6039
    6140#endif
Note: See TracChangeset for help on using the changeset viewer.