1
// Copyright 2011 Google Inc.
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
15
// Author: jmaessen@google.com (Jan Maessen)
17
#ifndef PAGESPEED_KERNEL_THREAD_PTHREAD_CONDVAR_H_
18
#define PAGESPEED_KERNEL_THREAD_PTHREAD_CONDVAR_H_
22
#include "pagespeed/kernel/base/condvar.h"
23
#include "pagespeed/kernel/base/basictypes.h"
24
#include "pagespeed/kernel/base/thread_system.h"
25
#include "pagespeed/kernel/thread/pthread_mutex.h"
27
namespace net_instaweb {
29
class PthreadCondvar : public ThreadSystem::Condvar {
31
// The mutex is owned by the caller and must outlive the condvar.
32
explicit PthreadCondvar(PthreadMutex* mutex)
36
virtual ~PthreadCondvar();
38
virtual PthreadMutex* mutex() const { return mutex_; }
40
virtual void Signal();
41
virtual void Broadcast();
43
virtual void TimedWait(int64 timeout_ms);
49
pthread_cond_t condvar_;
51
DISALLOW_COPY_AND_ASSIGN(PthreadCondvar);
54
} // namespace net_instaweb
56
#endif // PAGESPEED_KERNEL_THREAD_PTHREAD_CONDVAR_H_