folly/folly/executors/CPUThreadPoolExecutor.cpp

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <folly/Executor.h>
#include <folly/executors/CPUThreadPoolExecutor.h>

#include <atomic>
#include <folly/Memory.h>
#include <folly/Optional.h>
#include <folly/executors/QueueObserver.h>
#include <folly/executors/task_queue/PriorityLifoSemMPMCQueue.h>
#include <folly/executors/task_queue/PriorityUnboundedBlockingQueue.h>
#include <folly/executors/task_queue/UnboundedBlockingQueue.h>
#include <folly/portability/GFlags.h>
#include <folly/synchronization/ThrottledLifoSem.h>

FOLLY_GFLAGS_DEFINE_bool();

namespace folly {

const size_t CPUThreadPoolExecutor::kDefaultMaxQueueSize =;

CPUThreadPoolExecutor::CPUTask::CPUTask(
    Func&& f,
    std::chrono::milliseconds expiration,
    Func&& expireCallback,
    int8_t pri)
    :{}

CPUThreadPoolExecutor::CPUTask::CPUTask()
    :{}

/* static */ auto CPUThreadPoolExecutor::makeDefaultQueue()
    -> std::unique_ptr<BlockingQueue<CPUTask>> {}

/* static */ auto CPUThreadPoolExecutor::makeDefaultPriorityQueue(
    int8_t numPriorities) -> std::unique_ptr<BlockingQueue<CPUTask>> {}

/* static */ auto CPUThreadPoolExecutor::makeThrottledLifoSemQueue(
    std::chrono::nanoseconds wakeUpInterval)
    -> std::unique_ptr<BlockingQueue<CPUTask>> {}

/* static */ auto CPUThreadPoolExecutor::makeThrottledLifoSemPriorityQueue(
    int8_t numPriorities, std::chrono::nanoseconds wakeUpInterval)
    -> std::unique_ptr<BlockingQueue<CPUTask>> {}

CPUThreadPoolExecutor::CPUThreadPoolExecutor(
    size_t numThreads,
    std::unique_ptr<BlockingQueue<CPUTask>> taskQueue,
    std::shared_ptr<ThreadFactory> threadFactory,
    Options opt)
    :{}

CPUThreadPoolExecutor::CPUThreadPoolExecutor(
    std::pair<size_t, size_t> numThreads,
    std::unique_ptr<BlockingQueue<CPUTask>> taskQueue,
    std::shared_ptr<ThreadFactory> threadFactory,
    Options opt)
    :{}

CPUThreadPoolExecutor::CPUThreadPoolExecutor(
    size_t numThreads,
    std::shared_ptr<ThreadFactory> threadFactory,
    Options opt)
    :{}

CPUThreadPoolExecutor::CPUThreadPoolExecutor(
    std::pair<size_t, size_t> numThreads,
    std::shared_ptr<ThreadFactory> threadFactory,
    Options opt)
    :{}

CPUThreadPoolExecutor::CPUThreadPoolExecutor(size_t numThreads, Options opt)
    :{}

CPUThreadPoolExecutor::CPUThreadPoolExecutor(
    size_t numThreads,
    int8_t numPriorities,
    std::shared_ptr<ThreadFactory> threadFactory,
    Options opt)
    :{}

CPUThreadPoolExecutor::CPUThreadPoolExecutor(
    size_t numThreads,
    int8_t numPriorities,
    size_t maxQueueSize,
    std::shared_ptr<ThreadFactory> threadFactory,
    Options opt)
    :{}

CPUThreadPoolExecutor::~CPUThreadPoolExecutor() {}

QueueObserver* FOLLY_NULLABLE
CPUThreadPoolExecutor::getQueueObserver(int8_t pri) {}

void CPUThreadPoolExecutor::add(Func func) {}

void CPUThreadPoolExecutor::add(
    Func func, std::chrono::milliseconds expiration, Func expireCallback) {}

void CPUThreadPoolExecutor::addWithPriority(Func func, int8_t priority) {}

void CPUThreadPoolExecutor::add(
    Func func,
    int8_t priority,
    std::chrono::milliseconds expiration,
    Func expireCallback) {}

template <bool withPriority>
void CPUThreadPoolExecutor::addImpl(
    Func func,
    int8_t priority,
    std::chrono::milliseconds expiration,
    Func expireCallback) {}

uint8_t CPUThreadPoolExecutor::getNumPriorities() const {}

size_t CPUThreadPoolExecutor::getTaskQueueSize() const {}

WorkerProvider* CPUThreadPoolExecutor::getThreadIdCollector() {}

BlockingQueue<CPUThreadPoolExecutor::CPUTask>*
CPUThreadPoolExecutor::getTaskQueue() {}

// threadListLock_ must be writelocked.
bool CPUThreadPoolExecutor::tryDecrToStop() {}

bool CPUThreadPoolExecutor::taskShouldStop(folly::Optional<CPUTask>& task) {}

void CPUThreadPoolExecutor::threadRun(ThreadPtr thread) {}

void CPUThreadPoolExecutor::stopThreads(size_t n) {}

// threadListLock_ is read (or write) locked.
size_t CPUThreadPoolExecutor::getPendingTaskCountImpl() const {}

std::unique_ptr<folly::QueueObserverFactory>
CPUThreadPoolExecutor::createQueueObserverFactory() {}

} // namespace folly