Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scheduler_sequence.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef PAGESPEED_KERNEL_THREAD_SCHEDULER_SEQUENCE_H_
20 #define PAGESPEED_KERNEL_THREAD_SCHEDULER_SEQUENCE_H_
21 
24 #include "pagespeed/kernel/base/thread_annotations.h"
28 
29 namespace net_instaweb {
30 
34  public:
37  explicit Sequence(Scheduler* scheduler);
38  virtual ~Sequence();
39 
40  void Add(Function* function) override LOCKS_EXCLUDED(scheduler_->mutex());
41 
47  bool RunTasksUntil(int64 timeout_ms, bool* done)
48  EXCLUSIVE_LOCKS_REQUIRED(scheduler_->mutex());
49 
64  void ForwardToSequence(net_instaweb::Sequence* forwarding_sequence)
65  EXCLUSIVE_LOCKS_REQUIRED(scheduler_->mutex());
66 
67  private:
68  VectorDeque<Function*> work_queue_ GUARDED_BY(scheduler_->mutex());
69  Scheduler* scheduler_;
70  net_instaweb::Sequence* forwarding_sequence_ GUARDED_BY(scheduler_->mutex());
71 
72 
73 };
74 
75 }
76 
77 #endif
Definition: scheduler_sequence.h:33
Definition: vector_deque.h:47
Definition: sequence.h:33
Definition: function.h:47
void Add(Function *function) override LOCKS_EXCLUDED(scheduler_-> mutex())
void ForwardToSequence(net_instaweb::Sequence *forwarding_sequence) EXCLUSIVE_LOCKS_REQUIRED(scheduler_-> mutex())
Definition: scheduler.h:47
bool RunTasksUntil(int64 timeout_ms, bool *done) EXCLUSIVE_LOCKS_REQUIRED(scheduler_-> mutex())