DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (d8847129d134)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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