blob: 3e1020275c1f3961b125a5644fcb64120c891006 (
plain)
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
|
/*
* 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_PThreadData_DEFINED
#define SkThreadUtils_PThreadData_DEFINED
#include "SkThreadUtils.h"
#include <pthread.h>
class PThreadEvent : SkNoncopyable {
public:
PThreadEvent();
~PThreadEvent();
void trigger();
void wait();
bool isTriggered();
private:
pthread_cond_t fCondition;
pthread_mutex_t fConditionMutex;
bool fConditionFlag;
};
class SkThread_PThreadData : SkNoncopyable {
public:
SkThread_PThreadData(SkThread::entryPointProc entryPoint, void* data);
~SkThread_PThreadData();
pthread_t fPThread;
bool fValidPThread;
PThreadEvent fStarted;
PThreadEvent fCanceled;
pthread_attr_t fAttr;
void* fParam;
SkThread::entryPointProc fEntryPoint;
};
#endif
|