Changeset 228666c in mainline for kernel/generic


Ignore:
Timestamp:
2010-02-20T18:41:53Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b03a666
Parents:
bc9da2a
Message:

introduce atomic_count_t as the explicit type of the internal value in atomic_t (this is probably better than the chaotic mix of int/long)
atomic_count_t is defined as unsigned, for signed semantics you can cast it to atomic_signed_t

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/atomic.h

    rbc9da2a r228666c  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    3636#define KERN_ATOMIC_H_
    3737
     38#include <arch/types.h>
     39
    3840typedef struct atomic {
    39         volatile long count;
     41        volatile atomic_count_t count;
    4042} atomic_t;
    4143
    4244#include <arch/atomic.h>
    4345
    44 static inline void atomic_set(atomic_t *val, long i)
     46static inline void atomic_set(atomic_t *val, atomic_count_t i)
    4547{
    4648        val->count = i;
    4749}
    4850
    49 static inline long atomic_get(atomic_t *val)
     51static inline atomic_count_t atomic_get(atomic_t *val)
    5052{
    5153        return val->count;
  • kernel/generic/src/proc/scheduler.c

    rbc9da2a r228666c  
    542542{
    543543        thread_t *t;
    544         int count, average, j, k = 0;
     544        int count;
     545        atomic_count_t average;
    545546        unsigned int i;
     547        int j;
     548        int k = 0;
    546549        ipl_t ipl;
    547550
Note: See TracChangeset for help on using the changeset viewer.