Ptex
|
Platform-specific classes, functions, and includes. More...
#include "PtexInt.h"
#include <stdlib.h>
#include <alloca.h>
#include <string.h>
#include <pthread.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include "PtexVersion.h"
Go to the source code of this file.
Classes | |
class | Mutex |
class | SpinLock |
struct | AtomicCompareAndSwapImpl< T, n > |
struct | AtomicCompareAndSwapImpl< T, sizeof(uint32_t)> |
struct | AtomicCompareAndSwapImpl< T, sizeof(uint64_t)> |
Macros | |
#define | PtexPlatform_h |
#define | ATOMIC_ALIGNED __attribute__((aligned(8))) |
#define | ATOMIC_ADD32(x, y) __sync_add_and_fetch(x,y) |
#define | ATOMIC_ADD64(x, y) __sync_add_and_fetch(x,y) |
#define | ATOMIC_SUB32(x, y) __sync_sub_and_fetch(x,y) |
#define | ATOMIC_SUB64(x, y) __sync_sub_and_fetch(x,y) |
#define | MEM_FENCE() __sync_synchronize() |
#define | BOOL_CMPXCH32(x, y, z) __sync_bool_compare_and_swap((x),(y),(z)) |
#define | BOOL_CMPXCH64(x, y, z) __sync_bool_compare_and_swap((x),(y),(z)) |
#define | PTEX_INLINE inline __attribute__((always_inline)) |
#define | CACHE_LINE_SIZE 64 |
#define | CACHE_LINE_PAD(var, type) char var##_pad[CACHE_LINE_SIZE - sizeof(type)] |
#define | CACHE_LINE_PAD_INIT(var) memset(&var##_pad[0], 0, sizeof(var##_pad)) |
Typedefs | |
typedef off_t | FilePos |
Functions | |
template<typename T > | |
PTEX_INLINE T | AtomicAdd (volatile T *target, T value) |
template<typename T > | |
PTEX_INLINE T | AtomicIncrement (volatile T *target) |
template<typename T > | |
PTEX_INLINE T | AtomicSubtract (volatile T *target, T value) |
template<typename T > | |
PTEX_INLINE T | AtomicDecrement (volatile T *target) |
template<typename T > | |
PTEX_INLINE bool | AtomicCompareAndSwap (T volatile *target, T oldvalue, T newvalue) |
template<typename T > | |
PTEX_INLINE void | AtomicStore (T volatile *target, T value) |
PTEX_INLINE void | PtexMemoryFence () |
Platform-specific classes, functions, and includes.
Definition in file PtexPlatform.h.
#define ATOMIC_ADD32 | ( | x, | |
y | |||
) | __sync_add_and_fetch(x,y) |
Definition at line 183 of file PtexPlatform.h.
#define ATOMIC_ADD64 | ( | x, | |
y | |||
) | __sync_add_and_fetch(x,y) |
Definition at line 184 of file PtexPlatform.h.
#define ATOMIC_ALIGNED __attribute__((aligned(8))) |
Definition at line 182 of file PtexPlatform.h.
#define ATOMIC_SUB32 | ( | x, | |
y | |||
) | __sync_sub_and_fetch(x,y) |
Definition at line 185 of file PtexPlatform.h.
#define ATOMIC_SUB64 | ( | x, | |
y | |||
) | __sync_sub_and_fetch(x,y) |
Definition at line 186 of file PtexPlatform.h.
#define BOOL_CMPXCH32 | ( | x, | |
y, | |||
z | |||
) | __sync_bool_compare_and_swap((x),(y),(z)) |
Definition at line 188 of file PtexPlatform.h.
#define BOOL_CMPXCH64 | ( | x, | |
y, | |||
z | |||
) | __sync_bool_compare_and_swap((x),(y),(z)) |
Definition at line 189 of file PtexPlatform.h.
#define CACHE_LINE_PAD | ( | var, | |
type | |||
) | char var##_pad[CACHE_LINE_SIZE - sizeof(type)] |
Definition at line 290 of file PtexPlatform.h.
#define CACHE_LINE_PAD_INIT | ( | var | ) | memset(&var##_pad[0], 0, sizeof(var##_pad)) |
Definition at line 291 of file PtexPlatform.h.
#define CACHE_LINE_SIZE 64 |
Definition at line 287 of file PtexPlatform.h.
#define MEM_FENCE | ( | ) | __sync_synchronize() |
Definition at line 187 of file PtexPlatform.h.
#define PTEX_INLINE inline __attribute__((always_inline)) |
Definition at line 192 of file PtexPlatform.h.
#define PtexPlatform_h |
Definition at line 4 of file PtexPlatform.h.
typedef off_t FilePos |
Definition at line 88 of file PtexPlatform.h.
PTEX_INLINE T AtomicAdd | ( | volatile T * | target, |
T | value | ||
) |
Definition at line 198 of file PtexPlatform.h.
References ATOMIC_ADD32, and ATOMIC_ADD64.
Referenced by PtexReaderCache::adjustFilesOpen(), PtexReaderCache::adjustMemUsed(), AtomicIncrement(), and PtexReader::increaseMemUsed().
PTEX_INLINE bool AtomicCompareAndSwap | ( | T volatile * | target, |
T | oldvalue, | ||
T | newvalue | ||
) |
Definition at line 267 of file PtexPlatform.h.
Referenced by PtexReader::TiledReducedFace::getTile(), PtexHashMap< StringKey, PtexCachedReader * >::lockEntries(), PtexCachedReader::ref(), and PtexCachedReader::trylock().
PTEX_INLINE T AtomicDecrement | ( | volatile T * | target | ) |
Definition at line 236 of file PtexPlatform.h.
References AtomicSubtract().
Referenced by PtexCachedReader::unref().
PTEX_INLINE T AtomicIncrement | ( | volatile T * | target | ) |
Definition at line 214 of file PtexPlatform.h.
References AtomicAdd().
Referenced by PtexReader::logBlockRead(), PtexReader::logOpen(), and PtexReaderCache::logRecentlyUsed().
PTEX_INLINE void AtomicStore | ( | T volatile * | target, |
T | value | ||
) |
Definition at line 273 of file PtexPlatform.h.
References MEM_FENCE.
Referenced by PtexReader::open(), PtexReaderCache::processMru(), PtexReader::readFaceData(), PtexReader::readLevel(), PtexReader::readMetaData(), PtexCachedReader::unlock(), and PtexHashMap< StringKey, PtexCachedReader * >::unlockEntries().
PTEX_INLINE T AtomicSubtract | ( | volatile T * | target, |
T | value | ||
) |
Definition at line 220 of file PtexPlatform.h.
References ATOMIC_SUB32, and ATOMIC_SUB64.
Referenced by AtomicDecrement().
PTEX_INLINE void PtexMemoryFence | ( | ) |
Definition at line 279 of file PtexPlatform.h.
References MEM_FENCE.
Referenced by PtexHashMap< StringKey, PtexCachedReader * >::tryInsert().