#pragma once
#include <iostream>
#include <thread>
#include <mutex>
#include <deque>
#include <typeinfo>
#include <type_traits>
#include <condition_variable>
#include <functional>
#include <atomic>
enum NOTIFIY_TYPE{
ACTIVE,
PASSIVE
};
class TypeTable
{
public:
typedef std::mutex mtx_t;
typedef std::lock_guard<mtx_t> locker_t;
typedef std::unique_lock<mtx_t> un_lock_t;
typedef std::condition_variable cv_t;
typedef std::atomic<uint16_t> atm_ushor_t;
typedef std::atomic_bool atm_bool_t;
};
class TaskPool:public TypeTable{
public:
typedef std::function<void()> handl_work_t;
public:
TaskPool(TaskPool&& ref)=delete;
TaskPool(const TaskPool& oth) = delete;
TaskPool& operator=(const TaskPool& oth) = delete;
TaskPool& o
基于C++11实现的任务池
最新推荐文章于 2024-08-05 19:57:48 发布
本文深入探讨了如何利用C++11的新特性来构建一个高效的任务池系统,详细阐述了线程池的创建、任务调度以及线程同步等关键步骤,旨在帮助开发者更好地理解和应用C++11的并发编程技术。
摘要由CSDN通过智能技术生成