Changeset d359e227 in mainline


Ignore:
Timestamp:
2009-12-01T20:19:00Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
41df2827
Parents:
d9ece1cb
Message:

Add cas().
Implemented using GCC built-in.

File:
1 edited

Legend:

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

    rd9ece1cb rd359e227  
    3636#define LIBC_ATOMIC_H_
    3737
     38#include <bool.h>
     39
    3840typedef struct atomic {
    3941        volatile long count;
     
    5254}
    5355
     56static inline bool cas(atomic_t *val, long ov, long nv)
     57{
     58        return __sync_bool_compare_and_swap(&val->count, ov, nv);
     59}
     60
    5461#endif
    5562
Note: See TracChangeset for help on using the changeset viewer.