carb::tasking::CounterWrapper

Defined in carb/tasking/TaskingUtils.h

class CounterWrapper

Wrapper for a carb::tasking::Counter.

Public Functions

inline CounterWrapper(uint32_t target = 0)

Constructs a new CounterWrapper.

Parameters

target – An optional (default:0) target value for the Counter to become signaled.

inline CounterWrapper(ITasking *tasking, uint32_t target = 0)

Constructs a new CounterWrapper.

Note

Deprecated: The ITasking* parameter is no longer needed in this call.

Parameters
  • tasking – The acquired ITasking interface.

  • target – An optional (default:0) target value for the Counter to become signaled.

inline ~CounterWrapper()

Destrutor.

Warning

Destroying a Counter that is not signaled will assert in debug builds.

inline bool check() const
Returns

true if the Counter is signaled; false otherwise

inline bool try_wait() const
Returns

true if the Counter is signaled; false otherwise

inline void wait() const

Blocks the current thread or task in a fiber-safe way until the Counter becomes signaled.

template<class Rep, class Period>
inline bool wait_for(const std::chrono::duration<Rep, Period> &dur) const

Blocks the current thread or task in a fiber-safe way until the Counter becomes signaled or a period of time has elapsed.

Parameters

dur – The amount of time to wait for.

Returns

true if the Counter is signaled; false if the time period elapsed.

template<class Clock, class Duration>
inline bool wait_until(const std::chrono::time_point<Clock, Duration> &tp) const

Blocks the current thread or task in a fiber-safe way until the Counter becomes signaled or the clock reaches the given time point.

Parameters

tp – The time point to wait until.

Returns

true if the Counter is signaled; false if the clock time is reached.

inline operator Counter*() const

Convertible to Counter*.

inline ITasking *getTasking() const

Returns the acquired ITasking interface that was used to construct this object.

Note

Deprecated: Use carb::getCachedInterface instead.