blob: 8cbab58de267d871d18934f3e6794c385ff2572e [file] [log] [blame]
scroggo@google.com4177ef42012-10-31 15:52:16 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "SkCondVar.h"
9
10SkCondVar::SkCondVar() {
11 pthread_mutex_init(&fMutex, NULL /* default mutex attr */);
12 pthread_cond_init(&fCond, NULL /* default cond attr */);
13}
14
15SkCondVar::~SkCondVar() {
16 pthread_mutex_destroy(&fMutex);
17 pthread_cond_destroy(&fCond);
18}
19
20void SkCondVar::lock() {
21 pthread_mutex_lock(&fMutex);
22}
23
24void SkCondVar::unlock() {
25 pthread_mutex_unlock(&fMutex);
26}
27
28void SkCondVar::wait() {
29 pthread_cond_wait(&fCond, &fMutex);
30}
31
32void SkCondVar::signal() {
33 pthread_cond_signal(&fCond);
34}
35
36void SkCondVar::broadcast() {
37 pthread_cond_broadcast(&fCond);
38}