2 * Copyright 2015 Facebook, Inc.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <folly/Executor.h>
22 #include <folly/wangle/concurrent/IOExecutor.h>
24 namespace folly { namespace wangle {
26 // Retrieve the global Executor. If there is none, a default InlineExecutor
27 // will be constructed and returned. This is named CPUExecutor to distinguish
28 // it from IOExecutor below and to hint that it's intended for CPU-bound tasks.
29 std::shared_ptr<Executor> getCPUExecutor();
31 // Set an Executor to be the global Executor which will be returned by
32 // subsequent calls to getCPUExecutor(). Takes a non-owning (weak) reference.
33 void setCPUExecutor(std::shared_ptr<Executor> executor);
35 // Retrieve the global IOExecutor. If there is none, a default
36 // IOThreadPoolExecutor will be constructed and returned.
38 // IOExecutors differ from Executors in that they drive and provide access to
39 // one or more EventBases.
40 std::shared_ptr<IOExecutor> getIOExecutor();
42 // Set an IOExecutor to be the global IOExecutor which will be returned by
43 // subsequent calls to getIOExecutor(). Takes a non-owning (weak) reference.
44 void setIOExecutor(std::shared_ptr<IOExecutor> executor);