~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/pagespeed/kernel/thread/pthread_condvar.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2011 Google Inc.
2
 
//
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
6
 
//
7
 
//      http://www.apache.org/licenses/LICENSE-2.0
8
 
//
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.
14
 
//
15
 
// Author: jmaessen@google.com (Jan Maessen)
16
 
 
17
 
#ifndef PAGESPEED_KERNEL_THREAD_PTHREAD_CONDVAR_H_
18
 
#define PAGESPEED_KERNEL_THREAD_PTHREAD_CONDVAR_H_
19
 
 
20
 
#include <pthread.h>
21
 
 
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"
26
 
 
27
 
namespace net_instaweb {
28
 
 
29
 
class PthreadCondvar : public ThreadSystem::Condvar {
30
 
 public:
31
 
  // The mutex is owned by the caller and must outlive the condvar.
32
 
  explicit PthreadCondvar(PthreadMutex* mutex)
33
 
      : mutex_(mutex) {
34
 
    Init();
35
 
  }
36
 
  virtual ~PthreadCondvar();
37
 
 
38
 
  virtual PthreadMutex* mutex() const { return mutex_; }
39
 
 
40
 
  virtual void Signal();
41
 
  virtual void Broadcast();
42
 
  virtual void Wait();
43
 
  virtual void TimedWait(int64 timeout_ms);
44
 
 
45
 
 private:
46
 
  void Init();
47
 
 
48
 
  PthreadMutex* mutex_;
49
 
  pthread_cond_t condvar_;
50
 
 
51
 
  DISALLOW_COPY_AND_ASSIGN(PthreadCondvar);
52
 
};
53
 
 
54
 
}  // namespace net_instaweb
55
 
 
56
 
#endif  // PAGESPEED_KERNEL_THREAD_PTHREAD_CONDVAR_H_