~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/mod_spdy/src/mod_spdy/common/executor.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
 
#ifndef MOD_SPDY_COMMON_EXECUTOR_H_
16
 
#define MOD_SPDY_COMMON_EXECUTOR_H_
17
 
 
18
 
#include "base/basictypes.h"
19
 
#include "net/spdy/spdy_protocol.h"
20
 
 
21
 
namespace net_instaweb { class Function; }
22
 
 
23
 
namespace mod_spdy {
24
 
 
25
 
// An interface for a service that can execute tasks.  A thread pool (using
26
 
// net_instaweb::QueuedWorkerPool or an apr_thread_pool_t) would be one obvious
27
 
// implementation.  In the future we may want to adjust this interface for use
28
 
// in an event-driven environment (e.g. Nginx).
29
 
class Executor {
30
 
 public:
31
 
  Executor();
32
 
  virtual ~Executor();
33
 
 
34
 
  // Add a new task to be run; the executor takes ownership of the task.  The
35
 
  // priority argument hints at how important this task is to get done, but the
36
 
  // executor is free to ignore it.  If Stop has already been called, the
37
 
  // executor may immediately cancel the task rather than running it.
38
 
  virtual void AddTask(net_instaweb::Function* task,
39
 
                       net::SpdyPriority priority) = 0;
40
 
 
41
 
  // Stop the executor.  Cancel all tasks that were pushed onto this executor
42
 
  // but that have not yet begun to run.  Tasks that were already running will
43
 
  // continue to run, and this function must block until they have completed.
44
 
  // It must be safe to call this method more than once.
45
 
  virtual void Stop() = 0;
46
 
 
47
 
 private:
48
 
  DISALLOW_COPY_AND_ASSIGN(Executor);
49
 
};
50
 
 
51
 
}  // namespace mod_spdy
52
 
 
53
 
#endif  // MOD_SPDY_COMMON_EXECUTOR_H_