gfx/skia/trunk/include/utils/SkCountdown.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/utils/SkCountdown.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/*
     1.5 + * Copyright 2012 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef SkCountdown_DEFINED
    1.12 +#define SkCountdown_DEFINED
    1.13 +
    1.14 +#include "SkCondVar.h"
    1.15 +#include "SkRunnable.h"
    1.16 +#include "SkTypes.h"
    1.17 +
    1.18 +class SkCountdown : public SkRunnable {
    1.19 +public:
    1.20 +    explicit SkCountdown(int32_t count);
    1.21 +
    1.22 +    /**
    1.23 +     * Resets the countdown to the count provided.
    1.24 +     */
    1.25 +    void reset(int32_t count);
    1.26 +
    1.27 +    virtual void run() SK_OVERRIDE;
    1.28 +
    1.29 +    /**
    1.30 +     * Blocks until run() has been called count times.
    1.31 +     */
    1.32 +    void wait();
    1.33 +
    1.34 +private:
    1.35 +    SkCondVar fReady;
    1.36 +    int32_t   fCount;
    1.37 +};
    1.38 +
    1.39 +#endif

mercurial