Changeset e15e0e8 in mainline for uspace/lib/libc/include


Ignore:
Timestamp:
2009-12-02T22:29:46Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d04f709
Parents:
4702bde
Message:

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

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

Legend:

Unmodified
Added
Removed
  • 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.