gfx/skia/trunk/src/utils/SkThreadUtils.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/utils/SkThreadUtils.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     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 SkThreadUtils_DEFINED
    1.12 +#define SkThreadUtils_DEFINED
    1.13 +
    1.14 +#include "SkTypes.h"
    1.15 +
    1.16 +class SkThread : SkNoncopyable {
    1.17 +public:
    1.18 +    typedef void (*entryPointProc)(void*);
    1.19 +
    1.20 +    SkThread(entryPointProc entryPoint, void* data = NULL);
    1.21 +
    1.22 +    /**
    1.23 +     * Non-virtual, do not subclass.
    1.24 +     */
    1.25 +    ~SkThread();
    1.26 +
    1.27 +    /**
    1.28 +     * Starts the thread. Returns false if the thread could not be started.
    1.29 +     */
    1.30 +    bool start();
    1.31 +
    1.32 +    /**
    1.33 +     * Waits for the thread to finish.
    1.34 +     * If the thread has not started, returns immediately.
    1.35 +     */
    1.36 +    void join();
    1.37 +
    1.38 +    /**
    1.39 +     * SkThreads with an affinity for the same processor will attempt to run cache
    1.40 +     * locally with each other. SkThreads with an affinity for different processors
    1.41 +     * will attempt to run on different cores. Returns false if the request failed.
    1.42 +     */
    1.43 +    bool setProcessorAffinity(unsigned int processor);
    1.44 +
    1.45 +private:
    1.46 +    void* fData;
    1.47 +};
    1.48 +
    1.49 +#endif

mercurial