michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkCountdown_DEFINED michael@0: #define SkCountdown_DEFINED michael@0: michael@0: #include "SkCondVar.h" michael@0: #include "SkRunnable.h" michael@0: #include "SkTypes.h" michael@0: michael@0: class SkCountdown : public SkRunnable { michael@0: public: michael@0: explicit SkCountdown(int32_t count); michael@0: michael@0: /** michael@0: * Resets the countdown to the count provided. michael@0: */ michael@0: void reset(int32_t count); michael@0: michael@0: virtual void run() SK_OVERRIDE; michael@0: michael@0: /** michael@0: * Blocks until run() has been called count times. michael@0: */ michael@0: void wait(); michael@0: michael@0: private: michael@0: SkCondVar fReady; michael@0: int32_t fCount; michael@0: }; michael@0: michael@0: #endif