michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkThreadUtils_PThreadData_DEFINED michael@0: #define SkThreadUtils_PThreadData_DEFINED michael@0: michael@0: #include "SkThreadUtils.h" michael@0: #include michael@0: michael@0: class PThreadEvent : SkNoncopyable { michael@0: public: michael@0: PThreadEvent(); michael@0: ~PThreadEvent(); michael@0: void trigger(); michael@0: void wait(); michael@0: bool isTriggered(); michael@0: michael@0: private: michael@0: pthread_cond_t fCondition; michael@0: pthread_mutex_t fConditionMutex; michael@0: bool fConditionFlag; michael@0: }; michael@0: michael@0: class SkThread_PThreadData : SkNoncopyable { michael@0: public: michael@0: SkThread_PThreadData(SkThread::entryPointProc entryPoint, void* data); michael@0: ~SkThread_PThreadData(); michael@0: pthread_t fPThread; michael@0: bool fValidPThread; michael@0: PThreadEvent fStarted; michael@0: PThreadEvent fCanceled; michael@0: michael@0: pthread_attr_t fAttr; michael@0: michael@0: void* fParam; michael@0: SkThread::entryPointProc fEntryPoint; michael@0: }; michael@0: michael@0: #endif