PxSyncT

Defined in include/foundation/PxSync.h

template<typename Alloc = PxReflectionAllocator<PxSyncImpl>>
class PxSyncT : protected PxReflectionAllocator<PxSyncImpl>

Implementation notes:

  • Calling set() on an already signaled Sync does not change its state.

  • Calling reset() on an already reset Sync does not change its state.

  • Calling set() on a reset Sync wakes all waiting threads (potential for thread contention).

  • Calling wait() on an already signaled Sync will return true immediately.

  • NOTE: be careful when pulsing an event with set() followed by reset(), because a thread that is not waiting on the event will miss the signal.

Public Functions

inline PxSyncT(const Alloc &alloc = Alloc())
inline ~PxSyncT()
inline bool wait(uint32_t milliseconds = PxSyncImpl::waitForever)

Wait on the object for at most the given number of ms.

Returns true if the object is signaled. Sync::waitForever will block forever or until the object is signaled.

inline void set()

Signal the synchronization object, waking all threads waiting on it.

inline void reset()

Reset the synchronization object.

Public Static Attributes

static const uint32_t waitForever = PxSyncImpl::waitForever

Protected Static Functions

static inline void *allocate(size_t size, const char *filename, int line, uint32_t *cookie = NULL)
static inline void deallocate(void *ptr, uint32_t *cookie = NULL)