diff -r 000000000000 -r 6474c204b198 gfx/skia/trunk/src/utils/SkThreadUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gfx/skia/trunk/src/utils/SkThreadUtils.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,46 @@ +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkThreadUtils_DEFINED +#define SkThreadUtils_DEFINED + +#include "SkTypes.h" + +class SkThread : SkNoncopyable { +public: + typedef void (*entryPointProc)(void*); + + SkThread(entryPointProc entryPoint, void* data = NULL); + + /** + * Non-virtual, do not subclass. + */ + ~SkThread(); + + /** + * Starts the thread. Returns false if the thread could not be started. + */ + bool start(); + + /** + * Waits for the thread to finish. + * If the thread has not started, returns immediately. + */ + void join(); + + /** + * SkThreads with an affinity for the same processor will attempt to run cache + * locally with each other. SkThreads with an affinity for different processors + * will attempt to run on different cores. Returns false if the request failed. + */ + bool setProcessorAffinity(unsigned int processor); + +private: + void* fData; +}; + +#endif