diff options
author | Michal Krol <[email protected]> | 2009-03-16 13:07:22 +0100 |
---|---|---|
committer | Michal Krol <[email protected]> | 2009-03-16 13:15:50 +0100 |
commit | a7d42e11b4e97f19eaeb3b5ee811f04adb05b13d (patch) | |
tree | 01f6711dc77431dbf3242e077b19f26c07a051ad /src/gallium/include | |
parent | 102cb5c9cd5ce12fc43828e44e7baf390d4c351d (diff) |
gallium: Implement atomic interface for windows user mode subsystem.
Diffstat (limited to 'src/gallium/include')
-rw-r--r-- | src/gallium/include/pipe/p_atomic.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h index 773ae983436..13866d220e0 100644 --- a/src/gallium/include/pipe/p_atomic.h +++ b/src/gallium/include/pipe/p_atomic.h @@ -66,7 +66,41 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t new) return __sync_val_compare_and_swap(&v->count, old, new); } -#else /* (defined(PIPE_CC_GCC)) */ +#elif (defined(PIPE_SUBSYSTEM_WINDOWS_USER)) /* (defined(PIPE_CC_GCC)) */ + +struct pipe_atomic +{ + long count; +}; + +#define p_atomic_set(_v, _i) ((_v)->count = (_i)) +#define p_atomic_read(_v) ((_v)->count) + +static INLINE boolean +p_atomic_dec_zero(struct pipe_atomic *v) +{ + return InterlockedDecrement(&v->count); +} + +static INLINE void +p_atomic_inc(struct pipe_atomic *v) +{ + InterlockedIncrement(&v->count); +} + +static INLINE void +p_atomic_dec(struct pipe_atomic *v) +{ + InterlockedDecrement(&v->count); +} + +static INLINE int32_t +p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t new) +{ + return InterlockedCompareExchange(&v->count, new, old); +} + +#else /* (defined(PIPE_SUBSYSTEM_WINDOWS_USER)) */ #include "pipe/p_thread.h" |