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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /*
michael@0 2 * Copyright 2012 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef SkThreadUtils_DEFINED
michael@0 9 #define SkThreadUtils_DEFINED
michael@0 10
michael@0 11 #include "SkTypes.h"
michael@0 12
michael@0 13 class SkThread : SkNoncopyable {
michael@0 14 public:
michael@0 15 typedef void (*entryPointProc)(void*);
michael@0 16
michael@0 17 SkThread(entryPointProc entryPoint, void* data = NULL);
michael@0 18
michael@0 19 /**
michael@0 20 * Non-virtual, do not subclass.
michael@0 21 */
michael@0 22 ~SkThread();
michael@0 23
michael@0 24 /**
michael@0 25 * Starts the thread. Returns false if the thread could not be started.
michael@0 26 */
michael@0 27 bool start();
michael@0 28
michael@0 29 /**
michael@0 30 * Waits for the thread to finish.
michael@0 31 * If the thread has not started, returns immediately.
michael@0 32 */
michael@0 33 void join();
michael@0 34
michael@0 35 /**
michael@0 36 * SkThreads with an affinity for the same processor will attempt to run cache
michael@0 37 * locally with each other. SkThreads with an affinity for different processors
michael@0 38 * will attempt to run on different cores. Returns false if the request failed.
michael@0 39 */
michael@0 40 bool setProcessorAffinity(unsigned int processor);
michael@0 41
michael@0 42 private:
michael@0 43 void* fData;
michael@0 44 };
michael@0 45
michael@0 46 #endif

mercurial