├── doc ├── html │ ├── graph_legend.md5 │ ├── inherit_graph_0.md5 │ ├── inherit_graph_1.md5 │ ├── inherit_graph_2.md5 │ ├── inherit_graph_3.md5 │ ├── inherit_graph_4.md5 │ ├── inherit_graph_5.md5 │ ├── inherit_graph_6.md5 │ ├── inherit_graph_7.md5 │ ├── inherit_graph_8.md5 │ ├── inherit_graph_9.md5 │ ├── structTimerTask__coll__graph.md5 │ ├── classRunnable__inherit__graph.md5 │ ├── structFunctor__t__coll__graph.md5 │ ├── structFunctor__t__inherit__graph.md5 │ ├── structTimerTask__inherit__graph.md5 │ ├── structFunctor__base__inherit__graph.md5 │ ├── structThread_1_1Func__t__coll__graph.md5 │ ├── classThreadPoolExecutor__inherit__graph.md5 │ ├── classWorkStealingPoolExecutor__coll__graph.md5 │ ├── structRunnable_1_1functor__t__coll__graph.md5 │ ├── structThread_1_1Func__base__inherit__graph.md5 │ ├── structThread_1_1Func__t__inherit__graph.md5 │ ├── CPP.png │ ├── bc_s.png │ ├── bdwn.png │ ├── classScheduledThreadPoolExecutor__coll__graph.md5 │ ├── classScheduledThreadPoolExecutor__inherit__graph.md5 │ ├── classWorkStealingPoolExecutor__inherit__graph.md5 │ ├── classWorkStealingThreadPoolExecutor__coll__graph.md5 │ ├── doc.png │ ├── open.png │ ├── structRunnable_1_1functor__base__inherit__graph.md5 │ ├── structRunnable_1_1functor__t__inherit__graph.md5 │ ├── classWorkStealingThreadPoolExecutor__inherit__graph.md5 │ ├── closed.png │ ├── doxygen.png │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ ├── splitbar.png │ ├── sync_off.png │ ├── folderclosed.png │ ├── folderopen.png │ ├── graph_legend.png │ ├── search │ │ ├── close.png │ │ ├── mag_sel.png │ │ ├── search_l.png │ │ ├── search_m.png │ │ ├── search_r.png │ │ ├── classes_0.js │ │ ├── functions_10.js │ │ ├── variables_d.js │ │ ├── all_a.js │ │ ├── variables_5.js │ │ ├── classes_5.js │ │ ├── classes_6.js │ │ ├── variables_c.js │ │ ├── variables_1.js │ │ ├── classes_1.js │ │ ├── variables_4.js │ │ ├── classes_3.js │ │ ├── typedefs_0.js │ │ ├── all_13.js │ │ ├── all_8.js │ │ ├── functions_8.js │ │ ├── classes_4.js │ │ ├── all_c.js │ │ ├── functions_5.js │ │ ├── variables_8.js │ │ ├── variables_7.js │ │ ├── classes_2.js │ │ ├── all_3.js │ │ ├── functions_3.js │ │ ├── all_b.js │ │ ├── variables_6.js │ │ ├── variables_9.js │ │ ├── functions_9.js │ │ ├── variables_2.js │ │ ├── variables_3.js │ │ ├── searchdata.js │ │ ├── all_0.js │ │ ├── functions_0.js │ │ ├── variables_a.js │ │ ├── all_9.js │ │ ├── nomatches.html │ │ ├── variables_b.js │ │ ├── functions_4.js │ │ ├── functions_b.js │ │ ├── functions_1.js │ │ ├── all_d.js │ │ ├── functions_a.js │ │ ├── all_1.js │ │ ├── functions_7.js │ │ ├── all_5.js │ │ ├── all_4.js │ │ ├── variables_0.js │ │ ├── all_14.js │ │ ├── functions_11.js │ │ ├── all_e.js │ │ ├── functions_2.js │ │ ├── all_7.js │ │ ├── all_0.html │ │ ├── all_1.html │ │ ├── all_2.html │ │ ├── all_3.html │ │ ├── all_4.html │ │ ├── all_5.html │ │ ├── all_6.html │ │ ├── all_7.html │ │ ├── all_8.html │ │ ├── all_9.html │ │ ├── all_a.html │ │ ├── all_b.html │ │ ├── all_c.html │ │ ├── all_d.html │ │ ├── all_e.html │ │ ├── all_f.html │ │ ├── all_10.html │ │ ├── all_11.html │ │ ├── all_12.html │ │ ├── all_13.html │ │ ├── all_14.html │ │ ├── classes_0.html │ │ ├── classes_1.html │ │ ├── classes_2.html │ │ ├── classes_3.html │ │ ├── classes_4.html │ │ ├── classes_5.html │ │ ├── classes_6.html │ │ ├── typedefs_0.html │ │ ├── functions_0.html │ │ ├── functions_1.html │ │ ├── functions_10.html │ │ ├── functions_11.html │ │ ├── functions_2.html │ │ ├── functions_3.html │ │ ├── functions_4.html │ │ ├── functions_5.html │ │ ├── functions_6.html │ │ ├── functions_7.html │ │ ├── functions_8.html │ │ ├── functions_9.html │ │ ├── functions_a.html │ │ ├── functions_b.html │ │ ├── functions_c.html │ │ ├── functions_d.html │ │ ├── functions_e.html │ │ ├── functions_f.html │ │ ├── variables_0.html │ │ ├── variables_1.html │ │ ├── variables_2.html │ │ ├── variables_3.html │ │ ├── variables_4.html │ │ ├── variables_5.html │ │ ├── variables_6.html │ │ ├── variables_7.html │ │ ├── variables_8.html │ │ ├── variables_9.html │ │ ├── variables_a.html │ │ ├── variables_b.html │ │ ├── variables_c.html │ │ ├── variables_d.html │ │ ├── all_6.js │ │ ├── functions_6.js │ │ ├── all_2.js │ │ ├── functions_f.js │ │ ├── all_12.js │ │ ├── functions_c.js │ │ ├── functions_d.js │ │ ├── all_f.js │ │ ├── functions_e.js │ │ ├── all_11.js │ │ └── all_10.js │ ├── inherit_graph_0.png │ ├── inherit_graph_1.png │ ├── inherit_graph_2.png │ ├── inherit_graph_3.png │ ├── inherit_graph_4.png │ ├── inherit_graph_5.png │ ├── inherit_graph_6.png │ ├── inherit_graph_7.png │ ├── inherit_graph_8.png │ ├── inherit_graph_9.png │ ├── classRunnable__inherit__graph.png │ ├── structFunctor__t__coll__graph.png │ ├── structTimerTask__coll__graph.png │ ├── structFunctor__t__inherit__graph.png │ ├── structTimerTask__inherit__graph.png │ ├── structFunctor__base__inherit__graph.png │ ├── structThread_1_1Func__t__coll__graph.png │ ├── classThreadPoolExecutor__inherit__graph.png │ ├── structThread_1_1Func__t__inherit__graph.png │ ├── classWorkStealingPoolExecutor__coll__graph.png │ ├── structRunnable_1_1functor__t__coll__graph.png │ ├── structThread_1_1Func__base__inherit__graph.png │ ├── structRunnable_1_1functor__t__inherit__graph.png │ ├── classScheduledThreadPoolExecutor__coll__graph.png │ ├── classWorkStealingPoolExecutor__inherit__graph.png │ ├── inherit_graph_4.map │ ├── inherit_graph_5.map │ ├── structRunnable_1_1functor__base__inherit__graph.png │ ├── classScheduledThreadPoolExecutor__inherit__graph.png │ ├── classWorkStealingThreadPoolExecutor__coll__graph.png │ ├── classWorkStealingThreadPoolExecutor__inherit__graph.png │ ├── inherit_graph_6.map │ ├── classRunnable__inherit__graph.map │ ├── inherit_graph_2.map │ ├── inherit_graph_0.map │ ├── inherit_graph_8.map │ ├── inherit_graph_9.map │ ├── structFunctor__base__inherit__graph.map │ ├── structFunctor__t__coll__graph.map │ ├── structTimerTask__coll__graph.map │ ├── structFunctor__t__inherit__graph.map │ ├── structTimerTask__inherit__graph.map │ ├── structThread_1_1Func__base__inherit__graph.map │ ├── classWorkStealingPoolExecutor__coll__graph.map │ ├── classWorkStealingPoolExecutor__inherit__graph.map │ ├── classScheduledThreadPoolExecutor__coll__graph.map │ ├── structRunnable_1_1functor__t__coll__graph.map │ ├── structRunnable_1_1functor__t__inherit__graph.map │ ├── classScheduledThreadPoolExecutor__inherit__graph.map │ ├── classWorkStealingThreadPoolExecutor__coll__graph.map │ ├── structRunnable_1_1functor__base__inherit__graph.map │ ├── structThread_1_1Func__t__coll__graph.map │ ├── classWorkStealingThreadPoolExecutor__inherit__graph.map │ ├── structThread_1_1Func__t__inherit__graph.map │ ├── inherit_graph_1.map │ ├── inherit_graph_3.map │ ├── classThreadPoolExecutor__inherit__graph.map │ ├── inherit_graph_7.map │ ├── menu.js │ ├── index.html │ ├── functions_type.html │ └── menudata.js ├── latex │ ├── classRunnable__inherit__graph.md5 │ ├── structFunctor__t__coll__graph.md5 │ ├── structFunctor__t__inherit__graph.md5 │ ├── structTimerTask__coll__graph.md5 │ ├── structTimerTask__inherit__graph.md5 │ ├── structFunctor__base__inherit__graph.md5 │ ├── structThread_1_1Func__t__coll__graph.md5 │ ├── classThreadPoolExecutor__inherit__graph.md5 │ ├── classWorkStealingPoolExecutor__coll__graph.md5 │ ├── structRunnable_1_1functor__t__coll__graph.md5 │ ├── structThread_1_1Func__base__inherit__graph.md5 │ ├── structThread_1_1Func__t__inherit__graph.md5 │ ├── CPP.png │ ├── classScheduledThreadPoolExecutor__coll__graph.md5 │ ├── classWorkStealingPoolExecutor__inherit__graph.md5 │ ├── structRunnable_1_1functor__base__inherit__graph.md5 │ ├── structRunnable_1_1functor__t__inherit__graph.md5 │ ├── classScheduledThreadPoolExecutor__inherit__graph.md5 │ ├── classWorkStealingThreadPoolExecutor__coll__graph.md5 │ ├── classWorkStealingThreadPoolExecutor__inherit__graph.md5 │ ├── structTimerTask__coll__graph.pdf │ ├── classRunnable__inherit__graph.pdf │ ├── structFunctor__t__coll__graph.pdf │ ├── structTimerTask__inherit__graph.pdf │ ├── structFunctor__t__inherit__graph.pdf │ ├── structFunctor__base__inherit__graph.pdf │ ├── structThread_1_1Func__t__coll__graph.pdf │ ├── classThreadPoolExecutor__inherit__graph.pdf │ ├── structRunnable_1_1functor__t__coll__graph.pdf │ ├── structThread_1_1Func__t__inherit__graph.pdf │ ├── classWorkStealingPoolExecutor__coll__graph.pdf │ ├── structThread_1_1Func__base__inherit__graph.pdf │ ├── classScheduledThreadPoolExecutor__coll__graph.pdf │ ├── classWorkStealingPoolExecutor__inherit__graph.pdf │ ├── structRunnable_1_1functor__t__inherit__graph.pdf │ ├── classScheduledThreadPoolExecutor__inherit__graph.pdf │ ├── classWorkStealingThreadPoolExecutor__coll__graph.pdf │ ├── structRunnable_1_1functor__base__inherit__graph.pdf │ ├── classWorkStealingThreadPoolExecutor__inherit__graph.pdf │ ├── classFixedThreadPoolExecutor.tex │ ├── Makefile │ ├── structFunctor__base.tex │ ├── structThread_1_1Func__base.tex │ ├── structRunnable_1_1functor__base.tex │ ├── classRWLock.tex │ ├── hierarchy.tex │ ├── classinterrupt__flag.tex │ ├── annotated.tex │ ├── structThread_1_1Func__t.tex │ ├── classRejectedExecutionHandler.tex │ ├── structFunctor__t.tex │ └── structRunnable_1_1functor__t.tex └── CPP.png ├── include ├── threadpool.hpp ├── functor_wrapper.hpp ├── rwlock.hpp ├── semaphore.hpp └── runnable.hpp ├── example ├── test01.cpp ├── test11.cpp ├── test07.cpp ├── test02.cpp ├── rwlock_test.cpp ├── test08.cpp ├── test03.cpp ├── test06.cpp ├── test09.cpp ├── test05.cpp └── test04.cpp ├── README.md └── CMakeLists.txt /doc/html/graph_legend.md5: -------------------------------------------------------------------------------- 1 | da91725418da9273eaa26cdd6628bb6e -------------------------------------------------------------------------------- /doc/html/inherit_graph_0.md5: -------------------------------------------------------------------------------- 1 | 3a1cfedadfa697a9b616d9350deefbd2 -------------------------------------------------------------------------------- /doc/html/inherit_graph_1.md5: -------------------------------------------------------------------------------- 1 | 04cb2f16db5f89ef0254d85ad774e420 -------------------------------------------------------------------------------- /doc/html/inherit_graph_2.md5: -------------------------------------------------------------------------------- 1 | 8672077d86c6830ec08296675556ee23 -------------------------------------------------------------------------------- /doc/html/inherit_graph_3.md5: -------------------------------------------------------------------------------- 1 | 04ddece5502dc12b7d8843af3feee141 -------------------------------------------------------------------------------- /doc/html/inherit_graph_4.md5: -------------------------------------------------------------------------------- 1 | 6592b2d9a969defb2fbdd439f4a225c9 -------------------------------------------------------------------------------- /doc/html/inherit_graph_5.md5: -------------------------------------------------------------------------------- 1 | e10d17fb429c1578cc92e8ed19a418a3 -------------------------------------------------------------------------------- /doc/html/inherit_graph_6.md5: -------------------------------------------------------------------------------- 1 | 8dd729e188af28b5a5c82744d7517040 -------------------------------------------------------------------------------- /doc/html/inherit_graph_7.md5: -------------------------------------------------------------------------------- 1 | 2b1e21095050c83e392d621206eed63f -------------------------------------------------------------------------------- /doc/html/inherit_graph_8.md5: -------------------------------------------------------------------------------- 1 | ede7f11c1fd0b6e846b3414802fafa5e -------------------------------------------------------------------------------- /doc/html/inherit_graph_9.md5: -------------------------------------------------------------------------------- 1 | 48db8058e73c8236178a258cf321188d -------------------------------------------------------------------------------- /doc/html/structTimerTask__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 484632ed66322e5a82ed879fee47c338 -------------------------------------------------------------------------------- /doc/html/classRunnable__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 1e280062e007b5143191dc8f1df5075b -------------------------------------------------------------------------------- /doc/html/structFunctor__t__coll__graph.md5: -------------------------------------------------------------------------------- 1 | fbaf08454a47551724e738c30f5d71c3 -------------------------------------------------------------------------------- /doc/html/structFunctor__t__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 15e685c7f0b8848e355117d2db6218fe -------------------------------------------------------------------------------- /doc/html/structTimerTask__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | dd09772836cc09f061d83014d27c77d6 -------------------------------------------------------------------------------- /doc/latex/classRunnable__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 6e2011a37a4557bfbb751c665eee4819 -------------------------------------------------------------------------------- /doc/latex/structFunctor__t__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 156b8d0fd0068f82515a91305797912c -------------------------------------------------------------------------------- /doc/latex/structFunctor__t__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | b0b30e0da94ec4424b45a8895c720d6e -------------------------------------------------------------------------------- /doc/latex/structTimerTask__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 882354dc75af07fac5082c19fe5daad6 -------------------------------------------------------------------------------- /doc/latex/structTimerTask__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 91b1ec7d1dc850c0dfa9fd64ccce1041 -------------------------------------------------------------------------------- /doc/CPP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/CPP.png -------------------------------------------------------------------------------- /doc/html/structFunctor__base__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 6e8f175778eda9d3c981e11774786dbd -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__t__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 437889394083689b1a9c10c9acde360d -------------------------------------------------------------------------------- /doc/latex/structFunctor__base__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | e700c6972496fd493f2fbd95bdcc36d5 -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__t__coll__graph.md5: -------------------------------------------------------------------------------- 1 | c1ec4173d6cfb809d5c3275dcc87df9d -------------------------------------------------------------------------------- /doc/html/classThreadPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 6e0b796a9961892ab7e043f584a68c48 -------------------------------------------------------------------------------- /doc/html/classWorkStealingPoolExecutor__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 473a5b81f60612ccd6e3b1b5e52586d0 -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__t__coll__graph.md5: -------------------------------------------------------------------------------- 1 | ab13c44cd2e13956cdb184c269159e59 -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__base__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | f33cc7fc3a01641a02a4b9102188ffe8 -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__t__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 3b02262a31094fc5c89d5feb769f179c -------------------------------------------------------------------------------- /doc/latex/classThreadPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | d1a34588bad73c35ea6a47d9509d5b12 -------------------------------------------------------------------------------- /doc/latex/classWorkStealingPoolExecutor__coll__graph.md5: -------------------------------------------------------------------------------- 1 | b4f2601fb48d8dfd4fb05d53e32e02b9 -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__t__coll__graph.md5: -------------------------------------------------------------------------------- 1 | e2fc66549cd6893509643e0ff29a9e2b -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__base__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | cd4a02f76713df19f5292278969bbc10 -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__t__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 8ef02fdc832d43e8cfe461585b8f638b -------------------------------------------------------------------------------- /doc/html/CPP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/CPP.png -------------------------------------------------------------------------------- /doc/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/bc_s.png -------------------------------------------------------------------------------- /doc/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/bdwn.png -------------------------------------------------------------------------------- /doc/html/classScheduledThreadPoolExecutor__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 5415a79029faa1df32980df25dc9257c -------------------------------------------------------------------------------- /doc/html/classScheduledThreadPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 09184c9d8e04d2fb8588ab117f7f0319 -------------------------------------------------------------------------------- /doc/html/classWorkStealingPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | fee9477fcc5fa498fbcf554f81005be8 -------------------------------------------------------------------------------- /doc/html/classWorkStealingThreadPoolExecutor__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 99c925d30ce8a42bd95979d8c6a8a8de -------------------------------------------------------------------------------- /doc/html/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/doc.png -------------------------------------------------------------------------------- /doc/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/open.png -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__base__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | f8f345bc692e9570ceb93932beefd781 -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__t__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | df8bfe5876e38318e77d98f47892982f -------------------------------------------------------------------------------- /doc/latex/CPP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/CPP.png -------------------------------------------------------------------------------- /doc/latex/classScheduledThreadPoolExecutor__coll__graph.md5: -------------------------------------------------------------------------------- 1 | 4c9683e998c10842dffcf44d7a0fc8a4 -------------------------------------------------------------------------------- /doc/latex/classWorkStealingPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | b510d9b05dedb106cb2c0306b5f70260 -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__base__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 7398830efc378de71d807646c7e74ebc -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__t__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | b173d4cf85651bb518e5d3a0c2e5dcb4 -------------------------------------------------------------------------------- /doc/html/classWorkStealingThreadPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 8567884c12bc472be63d7d445567982d -------------------------------------------------------------------------------- /doc/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/closed.png -------------------------------------------------------------------------------- /doc/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/doxygen.png -------------------------------------------------------------------------------- /doc/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/nav_f.png -------------------------------------------------------------------------------- /doc/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/nav_g.png -------------------------------------------------------------------------------- /doc/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/nav_h.png -------------------------------------------------------------------------------- /doc/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/sync_on.png -------------------------------------------------------------------------------- /doc/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/tab_a.png -------------------------------------------------------------------------------- /doc/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/tab_b.png -------------------------------------------------------------------------------- /doc/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/tab_h.png -------------------------------------------------------------------------------- /doc/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/tab_s.png -------------------------------------------------------------------------------- /doc/latex/classScheduledThreadPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 01d02a6c6887a57017e136ea9d30cf6f -------------------------------------------------------------------------------- /doc/latex/classWorkStealingThreadPoolExecutor__coll__graph.md5: -------------------------------------------------------------------------------- 1 | f8fc9e30718e7b01d29467b81d3a6a35 -------------------------------------------------------------------------------- /doc/latex/classWorkStealingThreadPoolExecutor__inherit__graph.md5: -------------------------------------------------------------------------------- 1 | 8a9b8641138260dfdb280334b85cded9 -------------------------------------------------------------------------------- /doc/html/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/splitbar.png -------------------------------------------------------------------------------- /doc/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/sync_off.png -------------------------------------------------------------------------------- /doc/html/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/folderclosed.png -------------------------------------------------------------------------------- /doc/html/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/folderopen.png -------------------------------------------------------------------------------- /doc/html/graph_legend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/graph_legend.png -------------------------------------------------------------------------------- /doc/html/search/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/search/close.png -------------------------------------------------------------------------------- /doc/html/search/mag_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/search/mag_sel.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_0.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_1.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_2.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_3.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_4.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_5.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_6.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_7.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_8.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/inherit_graph_9.png -------------------------------------------------------------------------------- /doc/html/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/search/search_l.png -------------------------------------------------------------------------------- /doc/html/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/search/search_m.png -------------------------------------------------------------------------------- /doc/html/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/search/search_r.png -------------------------------------------------------------------------------- /doc/html/classRunnable__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classRunnable__inherit__graph.png -------------------------------------------------------------------------------- /doc/html/search/classes_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['blockingqueue',['BlockingQueue',['../classBlockingQueue.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/structFunctor__t__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structFunctor__t__coll__graph.png -------------------------------------------------------------------------------- /doc/html/structTimerTask__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structTimerTask__coll__graph.png -------------------------------------------------------------------------------- /doc/latex/structTimerTask__coll__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structTimerTask__coll__graph.pdf -------------------------------------------------------------------------------- /doc/html/structFunctor__t__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structFunctor__t__inherit__graph.png -------------------------------------------------------------------------------- /doc/html/structTimerTask__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structTimerTask__inherit__graph.png -------------------------------------------------------------------------------- /doc/latex/classRunnable__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classRunnable__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structFunctor__t__coll__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structFunctor__t__coll__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structTimerTask__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structTimerTask__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structFunctor__t__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structFunctor__t__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/html/structFunctor__base__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structFunctor__base__inherit__graph.png -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__t__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structThread_1_1Func__t__coll__graph.png -------------------------------------------------------------------------------- /doc/latex/structFunctor__base__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structFunctor__base__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__t__coll__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structThread_1_1Func__t__coll__graph.pdf -------------------------------------------------------------------------------- /doc/html/classThreadPoolExecutor__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classThreadPoolExecutor__inherit__graph.png -------------------------------------------------------------------------------- /doc/html/search/functions_10.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['yield',['yield',['../classThread.html#ac09e8b8ff4fb0a97315b5a501e722783',1,'Thread']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/search/variables_d.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['yield_5f',['yield_',['../classThread.html#a535df3b8fc4ff9ca48f5a6d561162a36',1,'Thread']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__t__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structThread_1_1Func__t__inherit__graph.png -------------------------------------------------------------------------------- /doc/html/classWorkStealingPoolExecutor__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classWorkStealingPoolExecutor__coll__graph.png -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__t__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structRunnable_1_1functor__t__coll__graph.png -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__base__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structThread_1_1Func__base__inherit__graph.png -------------------------------------------------------------------------------- /doc/latex/classThreadPoolExecutor__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classThreadPoolExecutor__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__t__coll__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structRunnable_1_1functor__t__coll__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__t__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structThread_1_1Func__t__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__t__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structRunnable_1_1functor__t__inherit__graph.png -------------------------------------------------------------------------------- /doc/latex/classWorkStealingPoolExecutor__coll__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classWorkStealingPoolExecutor__coll__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__base__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structThread_1_1Func__base__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/html/classScheduledThreadPoolExecutor__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classScheduledThreadPoolExecutor__coll__graph.png -------------------------------------------------------------------------------- /doc/html/classWorkStealingPoolExecutor__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classWorkStealingPoolExecutor__inherit__graph.png -------------------------------------------------------------------------------- /doc/html/inherit_graph_4.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_5.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/all_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['lastactivetime_5f',['lastActiveTime_',['../classThread.html#ae7ed71c6b1f7782ecd4186005fd70760',1,'Thread']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__base__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/structRunnable_1_1functor__base__inherit__graph.png -------------------------------------------------------------------------------- /doc/latex/classScheduledThreadPoolExecutor__coll__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classScheduledThreadPoolExecutor__coll__graph.pdf -------------------------------------------------------------------------------- /doc/latex/classWorkStealingPoolExecutor__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classWorkStealingPoolExecutor__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__t__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structRunnable_1_1functor__t__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/html/classScheduledThreadPoolExecutor__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classScheduledThreadPoolExecutor__inherit__graph.png -------------------------------------------------------------------------------- /doc/html/classWorkStealingThreadPoolExecutor__coll__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classWorkStealingThreadPoolExecutor__coll__graph.png -------------------------------------------------------------------------------- /doc/html/search/variables_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['lastactivetime_5f',['lastActiveTime_',['../classThread.html#ae7ed71c6b1f7782ecd4186005fd70760',1,'Thread']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/latex/classScheduledThreadPoolExecutor__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classScheduledThreadPoolExecutor__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/latex/classWorkStealingThreadPoolExecutor__coll__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classWorkStealingThreadPoolExecutor__coll__graph.pdf -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__base__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/structRunnable_1_1functor__base__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/html/classWorkStealingThreadPoolExecutor__inherit__graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/html/classWorkStealingThreadPoolExecutor__inherit__graph.png -------------------------------------------------------------------------------- /doc/latex/classWorkStealingThreadPoolExecutor__inherit__graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upider/CXX11ThreadPool/HEAD/doc/latex/classWorkStealingThreadPoolExecutor__inherit__graph.pdf -------------------------------------------------------------------------------- /doc/html/inherit_graph_6.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/classes_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['workstealingthreadpoolexecutor',['WorkStealingThreadPoolExecutor',['../classWorkStealingThreadPoolExecutor.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/search/classes_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['workstealingthreadpoolexecutor',['WorkStealingThreadPoolExecutor',['../classWorkStealingThreadPoolExecutor.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/search/variables_c.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['workqueues_5f',['workQueues_',['../classThreadPoolExecutor.html#a415491f8f40c0fcb99e7ec25cdd209d0',1,'ThreadPoolExecutor']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/classRunnable__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_2.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/variables_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['everpoolsize_5f',['everPoolSize_',['../classThreadPoolExecutor.html#ad8f4e68f28d617749537036f6e688b8c',1,'ThreadPoolExecutor']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_0.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/classes_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['functor_5fbase',['Functor_base',['../structFunctor__base.html',1,'']]], 4 | ['functor_5ft',['Functor_t',['../structFunctor__t.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /include/threadpool.hpp: -------------------------------------------------------------------------------- 1 | #ifndef THREADPOOL_H 2 | #define THREADPOOL_H 3 | 4 | #include "scheduledthreadpoolexecutor.hpp" 5 | #include "workstealingthreadpoolexecutor.hpp" 6 | 7 | #endif /* THREADPOOL_H */ 8 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_8.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_9.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/variables_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['keepnoncorethreadalive_5f',['keepNonCoreThreadAlive_',['../classThreadPoolExecutor.html#a2c8fc052c3760c89bf5198409d8c9c72',1,'ThreadPoolExecutor']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/structFunctor__base__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/structFunctor__t__coll__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/structTimerTask__coll__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/structFunctor__t__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/structTimerTask__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/classes_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['scheduledthreadpoolexecutor',['ScheduledThreadPoolExecutor',['../classScheduledThreadPoolExecutor.html',1,'']]], 4 | ['semaphore',['Semaphore',['../classSemaphore.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/typedefs_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sptr',['sptr',['../classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2',1,'Runnable::sptr()'],['../classThread.html#a430059e402325caaf1ed185fb520c9d2',1,'Thread::sptr()']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/search/all_13.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['yield',['yield',['../classThread.html#ac09e8b8ff4fb0a97315b5a501e722783',1,'Thread']]], 4 | ['yield_5f',['yield_',['../classThread.html#a535df3b8fc4ff9ca48f5a6d561162a36',1,'Thread']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/all_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['join',['join',['../classThread.html#a07b23d8d75300651cba3eb79652c77fd',1,'Thread']]], 4 | ['joinable',['joinable',['../classThread.html#a86d1c278c0b9fea63037c437a909064f',1,'Thread']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__base__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/functions_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['join',['join',['../classThread.html#a07b23d8d75300651cba3eb79652c77fd',1,'Thread']]], 4 | ['joinable',['joinable',['../classThread.html#a86d1c278c0b9fea63037c437a909064f',1,'Thread']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /example/test01.cpp: -------------------------------------------------------------------------------- 1 | //测试BlockingQueue,RejectedExecutionHandler 构造函数 2 | #include 3 | #include "threadpool.hpp" 4 | 5 | int main(void) 6 | { 7 | BlockingQueue bq{}; 8 | RejectedExecutionHandler rj; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /doc/html/classWorkStealingPoolExecutor__coll__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/classWorkStealingPoolExecutor__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/classScheduledThreadPoolExecutor__coll__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__t__coll__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__t__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/classScheduledThreadPoolExecutor__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/classes_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['thread',['Thread',['../classThread.html',1,'']]], 4 | ['threadpoolexecutor',['ThreadPoolExecutor',['../classThreadPoolExecutor.html',1,'']]], 5 | ['timertask',['TimerTask',['../structTimerTask.html',1,'']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /doc/html/classWorkStealingThreadPoolExecutor__coll__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/all_c.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['name_5f',['name_',['../classThread.html#aa222eb32e5fc8f386d9fb018607acd9c',1,'Thread']]], 4 | ['notempty_5f',['notEmpty_',['../classThreadPoolExecutor.html#ad523af8548ca8f1dae80cb295ee567b3',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/functions_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['front',['front',['../classBlockingQueue.html#adc86e513ba273cfa07cf5293806df412',1,'BlockingQueue']]], 4 | ['functor_5ft',['Functor_t',['../structFunctor__t.html#a1e788b8c1022f99a0e80b334b31383a2',1,'Functor_t']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/variables_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['prefix_5f',['prefix_',['../classThreadPoolExecutor.html#acf28232c8314da96403992137fdd1c2f',1,'ThreadPoolExecutor']]], 4 | ['prio_5f',['prio_',['../classThread.html#ada8c342b34fb001cfcf57619b7150840',1,'Thread']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/structRunnable_1_1functor__base__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__t__coll__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/classWorkStealingThreadPoolExecutor__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/variables_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['name_5f',['name_',['../classThread.html#aa222eb32e5fc8f386d9fb018607acd9c',1,'Thread']]], 4 | ['notempty_5f',['notEmpty_',['../classThreadPoolExecutor.html#ad523af8548ca8f1dae80cb295ee567b3',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/structThread_1_1Func__t__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /doc/html/search/classes_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['rejectedexecutionhandler',['RejectedExecutionHandler',['../classRejectedExecutionHandler.html',1,'']]], 4 | ['runnable',['Runnable',['../classRunnable.html',1,'']]], 5 | ['rwlock',['RWLock',['../classRWLock.html',1,'']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /doc/html/search/all_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['decrementworkercount',['decrementWorkerCount',['../classThreadPoolExecutor.html#ab19dcfa8af5864274e66bccf40255484',1,'ThreadPoolExecutor']]], 4 | ['detach',['detach',['../classThread.html#affb34b8590eab79785627ae48cbd297d',1,'Thread']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/functions_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['decrementworkercount',['decrementWorkerCount',['../classThreadPoolExecutor.html#ab19dcfa8af5864274e66bccf40255484',1,'ThreadPoolExecutor']]], 4 | ['detach',['detach',['../classThread.html#affb34b8590eab79785627ae48cbd297d',1,'Thread']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_1.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /doc/html/search/all_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['maxpoolsize_5f',['maxPoolSize_',['../classThreadPoolExecutor.html#a7fb9fd51e0a4b27277012c16596b9137',1,'ThreadPoolExecutor']]], 4 | ['mutex_5f',['mutex_',['../classThreadPoolExecutor.html#a2ef0eea2a8ca7a03bd9d361ced31f71b',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/variables_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['maxpoolsize_5f',['maxPoolSize_',['../classThreadPoolExecutor.html#a7fb9fd51e0a4b27277012c16596b9137',1,'ThreadPoolExecutor']]], 4 | ['mutex_5f',['mutex_',['../classThreadPoolExecutor.html#a2ef0eea2a8ca7a03bd9d361ced31f71b',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_3.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /doc/html/search/variables_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['rejecthandler_5f',['rejectHandler_',['../classThreadPoolExecutor.html#a347041db412b03aa09dd4e9b3beaa391',1,'ThreadPoolExecutor']]], 4 | ['running',['RUNNING',['../classThreadPoolExecutor.html#a9e28d5aa0cb4500921f7244565b8bed8',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/latex/classFixedThreadPoolExecutor.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{classFixedThreadPoolExecutor}{}\section{Fixed\+Thread\+Pool\+Executor类 参考} 2 | \label{classFixedThreadPoolExecutor}\index{Fixed\+Thread\+Pool\+Executor@{Fixed\+Thread\+Pool\+Executor}} 3 | 4 | 5 | 该类的文档由以下文件生成\+:\begin{DoxyCompactItemize} 6 | \item 7 | fixedthreadpoolexecutor.\+hpp\end{DoxyCompactItemize} 8 | -------------------------------------------------------------------------------- /doc/html/search/functions_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['keepnoncorethreadalive',['keepNonCoreThreadAlive',['../classThreadPoolExecutor.html#ac2aa11f7cde6e6082eb0dde8f2385dce',1,'ThreadPoolExecutor::keepNonCoreThreadAlive() const final'],['../classThreadPoolExecutor.html#a7e6ed2d088147377d1e82018ac3dac1d',1,'ThreadPoolExecutor::keepNonCoreThreadAlive(bool value) final']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /doc/html/search/variables_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['fixedrate_5f',['fixedRate_',['../structTimerTask.html#a31da300c15d00f58c2950e9752027e42',1,'TimerTask']]], 4 | ['func_5fuptr_5f',['func_uptr_',['../classThread.html#a4cf09d1f62096dd4aed7a3ee06212b81',1,'Thread']]], 5 | ['functor_5f',['functor_',['../classRunnable.html#a687268c89ddd0d1170687ba764cbc0f2',1,'Runnable']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /doc/html/search/variables_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['idle_5f',['idle_',['../classThread.html#a13aa04a60328060dec3a25b286c933a2',1,'Thread']]], 4 | ['initialdelay_5f',['initialDelay_',['../structTimerTask.html#af49a805f814a0b92e1f96037226a2d2e',1,'TimerTask']]], 5 | ['interval_5f',['interval_',['../structTimerTask.html#afd954f592d96d8abe152e0f54b30979e',1,'TimerTask']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /doc/html/classThreadPoolExecutor__inherit__graph.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /doc/html/inherit_graph_7.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /doc/html/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "abcdefgijklmnoprstwy~", 4 | 1: "bfrstw", 5 | 2: "abcdefgijkoprstwy~", 6 | 3: "cefiklmnprstwy", 7 | 4: "s" 8 | }; 9 | 10 | var indexSectionNames = 11 | { 12 | 0: "all", 13 | 1: "classes", 14 | 2: "functions", 15 | 3: "variables", 16 | 4: "typedefs" 17 | }; 18 | 19 | var indexSectionLabels = 20 | { 21 | 0: "全部", 22 | 1: "类", 23 | 2: "函数", 24 | 3: "变量", 25 | 4: "类型定义" 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /doc/html/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['addworker',['addWorker',['../classThreadPoolExecutor.html#aa4eb0971fc6f352df594186b6a118d6c',1,'ThreadPoolExecutor::addWorker(Runnable task, bool core=true)'],['../classThreadPoolExecutor.html#a9f108a305159ddf47923162f89a91a64',1,'ThreadPoolExecutor::addWorker(Runnable::sptr task, bool core=true)']]], 4 | ['advancerunstate',['advanceRunState',['../classThreadPoolExecutor.html#abaa3926310766a93b7fe1d83b77efdae',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/functions_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['addworker',['addWorker',['../classThreadPoolExecutor.html#aa4eb0971fc6f352df594186b6a118d6c',1,'ThreadPoolExecutor::addWorker(Runnable task, bool core=true)'],['../classThreadPoolExecutor.html#a9f108a305159ddf47923162f89a91a64',1,'ThreadPoolExecutor::addWorker(Runnable::sptr task, bool core=true)']]], 4 | ['advancerunstate',['advanceRunState',['../classThreadPoolExecutor.html#abaa3926310766a93b7fe1d83b77efdae',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /example/test11.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "thread.hpp" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | std::promise promise; 8 | std::future future(promise.get_future()); 9 | 10 | Thread t([&promise]() { 11 | std::cout << "thread start.." << std::endl; 12 | promise.set_value(999); 13 | }); 14 | 15 | t.start(); 16 | //不需要手动释放线程资源 17 | //t.join(); 18 | 19 | std::cout << future.get() << std::endl; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /doc/html/search/variables_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['shutdown',['SHUTDOWN',['../classThreadPoolExecutor.html#aa0958f2bf040bf2f199c629ec9145b44',1,'ThreadPoolExecutor']]], 4 | ['stop',['STOP',['../classThreadPoolExecutor.html#ae3c0ff657b3c0d8bbaf7f10bfdf587ca',1,'ThreadPoolExecutor']]], 5 | ['stop_5f',['stop_',['../classThread.html#a091bdad0a084b3f2c659f8cdd5369d53',1,'Thread']]], 6 | ['submitid_5f',['submitId_',['../classThreadPoolExecutor.html#a32da434f74911bcc1702eaafabfac368',1,'ThreadPoolExecutor']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /doc/html/search/all_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['keepnoncorethreadalive',['keepNonCoreThreadAlive',['../classThreadPoolExecutor.html#ac2aa11f7cde6e6082eb0dde8f2385dce',1,'ThreadPoolExecutor::keepNonCoreThreadAlive() const final'],['../classThreadPoolExecutor.html#a7e6ed2d088147377d1e82018ac3dac1d',1,'ThreadPoolExecutor::keepNonCoreThreadAlive(bool value) final']]], 4 | ['keepnoncorethreadalive_5f',['keepNonCoreThreadAlive_',['../classThreadPoolExecutor.html#a2c8fc052c3760c89bf5198409d8c9c72',1,'ThreadPoolExecutor']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
未找到
10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /doc/html/search/variables_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['terminated',['TERMINATED',['../classThreadPoolExecutor.html#a15bb29c714876435f3c59cd0137ac074',1,'ThreadPoolExecutor']]], 4 | ['thread_5f',['thread_',['../classThread.html#ad313ba812a7875c743dd0d37d565acfb',1,'Thread']]], 5 | ['threads_5f',['threads_',['../classThreadPoolExecutor.html#a47dd74330fa41d01067943b1db74818a',1,'ThreadPoolExecutor']]], 6 | ['tidying',['TIDYING',['../classThreadPoolExecutor.html#a3d2a0964f6bce420433491da80000c4c',1,'ThreadPoolExecutor']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /example/test07.cpp: -------------------------------------------------------------------------------- 1 | //测试Thread类 2 | #include 3 | #include 4 | #include "thread.hpp" 5 | 6 | int main(void) 7 | { 8 | Thread t([]() { 9 | std::cout << getCurrentThreadName() << std::endl; 10 | }, "Thread--t"); 11 | 12 | Thread tt([]() { 13 | std::cout << getCurrentThreadName() << std::endl; 14 | }, "Thread--tt"); 15 | 16 | tt.start(); 17 | tt.join(); 18 | 19 | t.start(); 20 | 21 | t.detach(); 22 | //t.join(); 23 | std::cout << "hooooooo" << std::endl; 24 | 25 | sleep(3); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /doc/latex/Makefile: -------------------------------------------------------------------------------- 1 | all: refman.pdf 2 | 3 | pdf: refman.pdf 4 | 5 | refman.pdf: clean refman.tex 6 | pdflatex refman 7 | makeindex refman.idx 8 | pdflatex refman 9 | latex_count=8 ; \ 10 | while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ 11 | do \ 12 | echo "Rerunning latex...." ;\ 13 | pdflatex refman ;\ 14 | latex_count=`expr $$latex_count - 1` ;\ 15 | done 16 | makeindex refman.idx 17 | pdflatex refman 18 | 19 | 20 | clean: 21 | rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf 22 | -------------------------------------------------------------------------------- /doc/html/search/functions_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['empty',['empty',['../classRunnable.html#a3abba14a5cf19709cef2d299ee68acae',1,'Runnable']]], 4 | ['execute',['execute',['../classThreadPoolExecutor.html#a4dac3c2435919af5d77aa36069d35bc7',1,'ThreadPoolExecutor::execute(Runnable::sptr command, bool core=true)'],['../classThreadPoolExecutor.html#a523df0545790ef03a82623b05e3b20f9',1,'ThreadPoolExecutor::execute(Runnable &command, bool core=true)'],['../classThreadPoolExecutor.html#a451bba3f90dbed2ba7e491ebc391b3c6',1,'ThreadPoolExecutor::execute(BlockingQueue< Runnable::sptr > &commands, bool core=true)']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /example/test02.cpp: -------------------------------------------------------------------------------- 1 | //测试std::vector threads; 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) 8 | { 9 | std::vector threads; 10 | 11 | for (int i = 0; i < 4; ++i) { 12 | threads.emplace_back([]() { 13 | std::cout << "thread id = " << std::this_thread::get_id() << std::endl; 14 | }); 15 | } 16 | 17 | for (int i = 0; i < 4; ++i) { 18 | if (threads[i].joinable()) { 19 | threads[i].join(); 20 | } 21 | } 22 | 23 | std::this_thread::sleep_for(std::chrono::seconds(2)); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /doc/html/search/functions_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['post',['post',['../classSemaphore.html#a93794b9ab0c6c7c35acce0769bf67caf',1,'Semaphore']]], 4 | ['prestartcorethreads',['preStartCoreThreads',['../classScheduledThreadPoolExecutor.html#aed48379bdc243fd07e593205ca28f48d',1,'ScheduledThreadPoolExecutor::preStartCoreThreads()'],['../classThreadPoolExecutor.html#aab8b3946a87fbecd144b159c12c8bcfb',1,'ThreadPoolExecutor::preStartCoreThreads()']]], 5 | ['put',['put',['../classBlockingQueue.html#a1c824f8d644951d25bed9825794ddeae',1,'BlockingQueue::put(const T &x)'],['../classBlockingQueue.html#acedd6887a4af752440fb2dcd04292fa3',1,'BlockingQueue::put(const T &&x)']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /doc/html/search/functions_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['back',['back',['../classBlockingQueue.html#a93c17143222334c4e4fe7035d4068bd0',1,'BlockingQueue']]], 4 | ['blockingqueue',['BlockingQueue',['../classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2',1,'BlockingQueue::BlockingQueue()'],['../classBlockingQueue.html#a265931efcceccd5c99ac76178507559b',1,'BlockingQueue::BlockingQueue(std::initializer_list< T > &args)'],['../classBlockingQueue.html#a2f2b1e4d887d77a81fddabd44c5cdbfd',1,'BlockingQueue::BlockingQueue(const BlockingQueue &)'],['../classBlockingQueue.html#a0d375ec5bec4f19887d0a4757d95e087',1,'BlockingQueue::BlockingQueue(const BlockingQueue &&rh)']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /include/functor_wrapper.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FUNCTOR_WRAPPER_HPP 2 | #define FUNCTOR_WRAPPER_HPP 3 | 4 | #include 5 | 6 | /** 7 | * @brief 函数包装器虚基类 8 | */ 9 | struct Functor_base { 10 | Functor_base() = default; 11 | virtual void call() = 0; 12 | virtual ~Functor_base() {} 13 | }; 14 | 15 | template 16 | struct Functor_t: Functor_base { 17 | /** 18 | * @brief functor_t 构造函数 19 | * 20 | * @param std::move(f) 包装的函数 21 | */ 22 | Functor_t(F&& f): f_(std::move(f)) {} 23 | /** 24 | * @brief call 执行被包装的函数 25 | */ 26 | void call() override { 27 | f_(); 28 | } 29 | F f_; 30 | }; 31 | #endif /* FUNCTOR_WRAPPER_HPP */ 32 | -------------------------------------------------------------------------------- /doc/html/search/all_d.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['operator_28_29',['operator()',['../classRunnable.html#a38bf849dab4bbb86fc5bc6e7aff383e0',1,'Runnable']]], 4 | ['operator_3d',['operator=',['../classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325',1,'BlockingQueue::operator=(const BlockingQueue &)'],['../classBlockingQueue.html#abbe4440d6ed06d175925bba1f3c02312',1,'BlockingQueue::operator=(const BlockingQueue &&)'],['../classRunnable.html#a572b61c98700ada8d241b122ddc80e2c',1,'Runnable::operator=(Runnable &&rh)'],['../classRunnable.html#a4dca857ef9f64534673170bc3c8b72a1',1,'Runnable::operator=(Runnable &rh)'],['../structTimerTask.html#a3dfbb5770a1e3496f4e34d0795565c79',1,'TimerTask::operator=()']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/functions_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['operator_28_29',['operator()',['../classRunnable.html#a38bf849dab4bbb86fc5bc6e7aff383e0',1,'Runnable']]], 4 | ['operator_3d',['operator=',['../classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325',1,'BlockingQueue::operator=(const BlockingQueue &)'],['../classBlockingQueue.html#abbe4440d6ed06d175925bba1f3c02312',1,'BlockingQueue::operator=(const BlockingQueue &&)'],['../classRunnable.html#a572b61c98700ada8d241b122ddc80e2c',1,'Runnable::operator=(Runnable &&rh)'],['../classRunnable.html#a4dca857ef9f64534673170bc3c8b72a1',1,'Runnable::operator=(Runnable &rh)'],['../structTimerTask.html#a3dfbb5770a1e3496f4e34d0795565c79',1,'TimerTask::operator=()']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/all_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['back',['back',['../classBlockingQueue.html#a93c17143222334c4e4fe7035d4068bd0',1,'BlockingQueue']]], 4 | ['blockingqueue',['BlockingQueue',['../classBlockingQueue.html',1,'BlockingQueue< T >'],['../classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2',1,'BlockingQueue::BlockingQueue()'],['../classBlockingQueue.html#a265931efcceccd5c99ac76178507559b',1,'BlockingQueue::BlockingQueue(std::initializer_list< T > &args)'],['../classBlockingQueue.html#a2f2b1e4d887d77a81fddabd44c5cdbfd',1,'BlockingQueue::BlockingQueue(const BlockingQueue &)'],['../classBlockingQueue.html#a0d375ec5bec4f19887d0a4757d95e087',1,'BlockingQueue::BlockingQueue(const BlockingQueue &&rh)']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /doc/html/search/functions_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['is_5fempty',['is_empty',['../classBlockingQueue.html#a06f9211f5225bb6413f403e8d14ca7ce',1,'BlockingQueue']]], 4 | ['isidle',['isIdle',['../classThread.html#acb6c590deecea4778a855459f080060a',1,'Thread']]], 5 | ['isrunning',['isRunning',['../classThread.html#ab4c718f3ca4aa7514c7e89e38f9da894',1,'Thread::isRunning()'],['../classThreadPoolExecutor.html#a841ae2189d6f85b9df9f69dec5375341',1,'ThreadPoolExecutor::isRunning()']]], 6 | ['isshutdown',['isShutDown',['../classThreadPoolExecutor.html#ac33c356670eabe5345992331e615348c',1,'ThreadPoolExecutor']]], 7 | ['isterminated',['isTerminated',['../classThreadPoolExecutor.html#a89ed68d6c67ad6fbde73b7883c8107a7',1,'ThreadPoolExecutor']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /doc/html/search/all_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['fixedrate_5f',['fixedRate_',['../structTimerTask.html#a31da300c15d00f58c2950e9752027e42',1,'TimerTask']]], 4 | ['front',['front',['../classBlockingQueue.html#adc86e513ba273cfa07cf5293806df412',1,'BlockingQueue']]], 5 | ['func_5fuptr_5f',['func_uptr_',['../classThread.html#a4cf09d1f62096dd4aed7a3ee06212b81',1,'Thread']]], 6 | ['functor_5f',['functor_',['../classRunnable.html#a687268c89ddd0d1170687ba764cbc0f2',1,'Runnable']]], 7 | ['functor_5fbase',['Functor_base',['../structFunctor__base.html',1,'']]], 8 | ['functor_5ft',['Functor_t',['../structFunctor__t.html',1,'Functor_t< F >'],['../structFunctor__t.html#a1e788b8c1022f99a0e80b334b31383a2',1,'Functor_t::Functor_t()']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /doc/html/search/all_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['empty',['empty',['../classRunnable.html#a3abba14a5cf19709cef2d299ee68acae',1,'Runnable']]], 4 | ['everpoolsize_5f',['everPoolSize_',['../classThreadPoolExecutor.html#ad8f4e68f28d617749537036f6e688b8c',1,'ThreadPoolExecutor']]], 5 | ['execute',['execute',['../classThreadPoolExecutor.html#a4dac3c2435919af5d77aa36069d35bc7',1,'ThreadPoolExecutor::execute(Runnable::sptr command, bool core=true)'],['../classThreadPoolExecutor.html#a523df0545790ef03a82623b05e3b20f9',1,'ThreadPoolExecutor::execute(Runnable &command, bool core=true)'],['../classThreadPoolExecutor.html#a451bba3f90dbed2ba7e491ebc391b3c6',1,'ThreadPoolExecutor::execute(BlockingQueue< Runnable::sptr > &commands, bool core=true)']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /doc/html/search/variables_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['calltime_5f',['callTime_',['../structTimerTask.html#a7bcf4dfd5b91038d4c4c5378285d4ed0',1,'TimerTask']]], 4 | ['capacity',['CAPACITY',['../classThreadPoolExecutor.html#aac96b726327ad0d07709085ab49c4f58',1,'ThreadPoolExecutor']]], 5 | ['corepoolsize_5f',['corePoolSize_',['../classThreadPoolExecutor.html#ac4496adc7a7ff18b97464a863fcf4a73',1,'ThreadPoolExecutor']]], 6 | ['count_5fbits',['COUNT_BITS',['../classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42',1,'ThreadPoolExecutor']]], 7 | ['ctl_5f',['ctl_',['../classThreadPoolExecutor.html#a010113b7aac17ef364d417c485263873',1,'ThreadPoolExecutor']]], 8 | ['currentpid_5f',['currentPid_',['../classThread.html#a0c0878a96696bbb092a69bc2f1f812fd',1,'Thread']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /example/rwlock_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "rwlock.hpp" 3 | #include "thread.hpp" 4 | 5 | int main(void) 6 | { 7 | RWLock rwLock; 8 | int x = 0; 9 | 10 | Thread tRead([&]() { 11 | for(;;) { 12 | rwLock.rdLock(); 13 | std::cout << x << std::endl; 14 | rwLock.unlock(); 15 | if (x >= 999) { 16 | break; 17 | } 18 | } 19 | }, "read_thread"); 20 | 21 | Thread tWrite([&]() { 22 | for(int i = 0; i < 1000; i++) { 23 | rwLock.wrLock(); 24 | x++; 25 | std::cout << "write operation x++" << std::endl; 26 | rwLock.unlock(); 27 | } 28 | }, "write_thrad"); 29 | 30 | tRead.start(); 31 | tWrite.start(); 32 | 33 | sleep(3); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /doc/html/search/all_14.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['_7erejectedexecutionhandler',['~RejectedExecutionHandler',['../classRejectedExecutionHandler.html#a640bb013143221dd4729b270da83ec5e',1,'RejectedExecutionHandler']]], 4 | ['_7erunnable',['~Runnable',['../classRunnable.html#a08557328273d2dfd3425507b1f972fcb',1,'Runnable']]], 5 | ['_7escheduledthreadpoolexecutor',['~ScheduledThreadPoolExecutor',['../classScheduledThreadPoolExecutor.html#aa8d3f9083aa92b351be6e134d7a675ea',1,'ScheduledThreadPoolExecutor']]], 6 | ['_7esemaphore',['~Semaphore',['../classSemaphore.html#a7039839a61ed189258fb0de6338848e3',1,'Semaphore']]], 7 | ['_7ethread',['~Thread',['../classThread.html#a026b23628e1727050e864e00489c0baf',1,'Thread']]], 8 | ['_7ethreadpoolexecutor',['~ThreadPoolExecutor',['../classThreadPoolExecutor.html#a1d5a1c3330593f243959256d32068c15',1,'ThreadPoolExecutor']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /doc/html/search/functions_11.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['_7erejectedexecutionhandler',['~RejectedExecutionHandler',['../classRejectedExecutionHandler.html#a640bb013143221dd4729b270da83ec5e',1,'RejectedExecutionHandler']]], 4 | ['_7erunnable',['~Runnable',['../classRunnable.html#a08557328273d2dfd3425507b1f972fcb',1,'Runnable']]], 5 | ['_7escheduledthreadpoolexecutor',['~ScheduledThreadPoolExecutor',['../classScheduledThreadPoolExecutor.html#aa8d3f9083aa92b351be6e134d7a675ea',1,'ScheduledThreadPoolExecutor']]], 6 | ['_7esemaphore',['~Semaphore',['../classSemaphore.html#a7039839a61ed189258fb0de6338848e3',1,'Semaphore']]], 7 | ['_7ethread',['~Thread',['../classThread.html#a026b23628e1727050e864e00489c0baf',1,'Thread']]], 8 | ['_7ethreadpoolexecutor',['~ThreadPoolExecutor',['../classThreadPoolExecutor.html#a1d5a1c3330593f243959256d32068c15',1,'ThreadPoolExecutor']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /example/test08.cpp: -------------------------------------------------------------------------------- 1 | //测试workstealingpoolexecutor 2 | #include "workstealingthreadpoolexecutor.hpp" 3 | 4 | int main(void) 5 | { 6 | WorkStealingThreadPoolExecutor wsThreadPool(1, 3); 7 | wsThreadPool.keepNonCoreThreadAlive(true); 8 | 9 | wsThreadPool.submit([]() { 10 | std::cout << syscall(__NR_gettid) << std::endl; 11 | }); 12 | wsThreadPool.submit([]() { 13 | std::cout << syscall(__NR_gettid) << std::endl; 14 | }); 15 | for (int i = 0; i < 10; ++i) { 16 | wsThreadPool.submit([]() { 17 | sleep(1); 18 | std::cout << syscall(__NR_gettid) << std::endl; 19 | }, false); 20 | } 21 | std::cout << wsThreadPool.toString() << std::endl; 22 | wsThreadPool.shutdown(); 23 | sleep(2); 24 | wsThreadPool.stop(); 25 | std::cout << wsThreadPool.toString() << std::endl; 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /doc/html/search/all_e.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['post',['post',['../classSemaphore.html#a93794b9ab0c6c7c35acce0769bf67caf',1,'Semaphore']]], 4 | ['prefix_5f',['prefix_',['../classThreadPoolExecutor.html#acf28232c8314da96403992137fdd1c2f',1,'ThreadPoolExecutor']]], 5 | ['prestartcorethreads',['preStartCoreThreads',['../classScheduledThreadPoolExecutor.html#aed48379bdc243fd07e593205ca28f48d',1,'ScheduledThreadPoolExecutor::preStartCoreThreads()'],['../classThreadPoolExecutor.html#aab8b3946a87fbecd144b159c12c8bcfb',1,'ThreadPoolExecutor::preStartCoreThreads()']]], 6 | ['prio_5f',['prio_',['../classThread.html#ada8c342b34fb001cfcf57619b7150840',1,'Thread']]], 7 | ['put',['put',['../classBlockingQueue.html#a1c824f8d644951d25bed9825794ddeae',1,'BlockingQueue::put(const T &x)'],['../classBlockingQueue.html#acedd6887a4af752440fb2dcd04292fa3',1,'BlockingQueue::put(const T &&x)']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /doc/html/search/functions_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['call',['call',['../structFunctor__t.html#ab4fc359c4f5955cc2d6a86214a5545ce',1,'Functor_t']]], 4 | ['compareanddecrementworkercount',['compareAndDecrementWorkerCount',['../classThreadPoolExecutor.html#ac40053b88cd669526a0a6225b5e1a86e',1,'ThreadPoolExecutor']]], 5 | ['compareandincrementworkercount',['compareAndIncrementWorkerCount',['../classThreadPoolExecutor.html#ac1bcafe65f800aeb9feade5f31b64fde',1,'ThreadPoolExecutor']]], 6 | ['coreworkerthread',['coreWorkerThread',['../classThreadPoolExecutor.html#a5e40839bf4191b5eab9d81227ddb62c3',1,'ThreadPoolExecutor::coreWorkerThread()'],['../classWorkStealingThreadPoolExecutor.html#a9a9ad791af26c0809a9e1864544930aa',1,'WorkStealingThreadPoolExecutor::coreWorkerThread()']]], 7 | ['ctlof',['ctlOf',['../classThreadPoolExecutor.html#a31ed7a73571c79c8dbb486f27a4df4eb',1,'ThreadPoolExecutor']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /example/test03.cpp: -------------------------------------------------------------------------------- 1 | //测试submit方法,toString方法 2 | #include 3 | #include 4 | #include "runnable.hpp" 5 | #include "threadpool.hpp" 6 | 7 | int hello(int v) { 8 | return 100; 9 | } 10 | 11 | int main(void) 12 | { 13 | ThreadPoolExecutor tpe(1, 1); 14 | std::future f; 15 | std::future f2; 16 | for (int i = 0; i < 1; ++i) { 17 | f = tpe.submit(std::bind(&hello, 100)); 18 | f2 = tpe.submit([]() -> int{ 19 | std::cout << std::this_thread::get_id() << std::endl; 20 | return 10000; 21 | }); 22 | } 23 | 24 | std::cout << "f = " << f.get() << std::endl; 25 | std::cout << "f2 = " << f2.get() << std::endl; 26 | std::this_thread::sleep_for(std::chrono::seconds(1)); 27 | std::cout << tpe.toString() << std::endl; 28 | tpe.shutdown(); 29 | //没有stop线程池不会退出 30 | tpe.stop(); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /doc/latex/structFunctor__base.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structFunctor__base}{}\section{Functor\+\_\+base结构体 参考} 2 | \label{structFunctor__base}\index{Functor\+\_\+base@{Functor\+\_\+base}} 3 | 4 | 5 | 函数包装器虚基类 6 | 7 | 8 | 9 | 10 | {\ttfamily \#include $<$functor\+\_\+wrapper.\+hpp$>$} 11 | 12 | 13 | 14 | 类 Functor\+\_\+base 继承关系图\+: 15 | \nopagebreak 16 | \begin{figure}[H] 17 | \begin{center} 18 | \leavevmode 19 | \includegraphics[width=162pt]{structFunctor__base__inherit__graph} 20 | \end{center} 21 | \end{figure} 22 | \subsection*{Public 成员函数} 23 | \begin{DoxyCompactItemize} 24 | \item 25 | \mbox{\Hypertarget{structFunctor__base_a249b2f421002975fa78a41ec349e53bf}\label{structFunctor__base_a249b2f421002975fa78a41ec349e53bf}} 26 | virtual void {\bfseries call} ()=0 27 | \end{DoxyCompactItemize} 28 | 29 | 30 | \subsection{详细描述} 31 | 函数包装器虚基类 32 | 33 | 该结构体的文档由以下文件生成\+:\begin{DoxyCompactItemize} 34 | \item 35 | functor\+\_\+wrapper.\+hpp\end{DoxyCompactItemize} 36 | -------------------------------------------------------------------------------- /include/rwlock.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RWLOCK_HPP 2 | #define RWLOCK_HPP 3 | 4 | #include 5 | 6 | class RWLock { 7 | private: 8 | pthread_rwlock_t rwlock_; 9 | 10 | public: 11 | int rdLock() { 12 | return pthread_rwlock_rdlock(&rwlock_); 13 | } 14 | 15 | int wrLock() { 16 | return pthread_rwlock_wrlock(&rwlock_); 17 | } 18 | 19 | int unlock() { 20 | return pthread_rwlock_unlock(&rwlock_); 21 | } 22 | 23 | int tryRdLock() { 24 | return pthread_rwlock_tryrdlock(&rwlock_); 25 | } 26 | 27 | int tryWrLock() { 28 | return pthread_rwlock_trywrlock(&rwlock_); 29 | } 30 | 31 | public: 32 | RWLock() { 33 | pthread_rwlock_init(&rwlock_, nullptr); 34 | } 35 | 36 | virtual ~RWLock () { 37 | pthread_rwlock_destroy(&rwlock_); 38 | } 39 | }; 40 | 41 | #endif /* RWLOCK_HPP */ 42 | -------------------------------------------------------------------------------- /example/test06.cpp: -------------------------------------------------------------------------------- 1 | //测试Thread类 2 | #include 3 | #include 4 | #include "thread.hpp" 5 | 6 | class MyThread : public Thread { 7 | virtual void run() override { 8 | //std::cout << std::this_thread::get_id() << std::endl; 9 | std::cout << getCurrentThreadName() << std::endl; 10 | } 11 | }; 12 | 13 | int main(void) 14 | { 15 | Thread tt([]() { 16 | sleep(3); 17 | std::cout << getCurrentThreadName() << std::endl; 18 | }, "Thread--t"); 19 | //tt.setName("ttaaaaa"); 20 | 21 | MyThread t; 22 | t.setName("Thread--tt"); 23 | 24 | t.start(); 25 | tt.start(); 26 | std::cout << "t:" << t.getPid() << std::endl; 27 | std::cout << "tt:" << tt.getPid() << std::endl; 28 | 29 | sleep(3); 30 | std::cout << std::chrono::duration(std::chrono::steady_clock::now() - tt.getLastActiveTime()).count() << std::endl; 31 | 32 | 33 | t.join(); 34 | tt.join(); 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__base.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structThread_1_1Func__base}{}\section{Thread\+:\+:Func\+\_\+base结构体 参考} 2 | \label{structThread_1_1Func__base}\index{Thread\+::\+Func\+\_\+base@{Thread\+::\+Func\+\_\+base}} 3 | 4 | 5 | 包装传进来的lambda函数的虚基类 6 | 7 | 8 | 9 | 10 | {\ttfamily \#include $<$thread.\+hpp$>$} 11 | 12 | 13 | 14 | 类 Thread\+:\+:Func\+\_\+base 继承关系图\+:\nopagebreak 15 | \begin{figure}[H] 16 | \begin{center} 17 | \leavevmode 18 | \includegraphics[width=209pt]{structThread_1_1Func__base__inherit__graph} 19 | \end{center} 20 | \end{figure} 21 | \subsection*{Public 成员函数} 22 | \begin{DoxyCompactItemize} 23 | \item 24 | \mbox{\Hypertarget{structThread_1_1Func__base_a53caa79f4dd5f1b90690a14e7c1e0437}\label{structThread_1_1Func__base_a53caa79f4dd5f1b90690a14e7c1e0437}} 25 | virtual void {\bfseries call} ()=0 26 | \end{DoxyCompactItemize} 27 | 28 | 29 | \subsection{详细描述} 30 | 包装传进来的lambda函数的虚基类 31 | 32 | 该结构体的文档由以下文件生成\+:\begin{DoxyCompactItemize} 33 | \item 34 | thread.\+hpp\end{DoxyCompactItemize} 35 | -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__base.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structRunnable_1_1functor__base}{}\section{Runnable\+:\+:functor\+\_\+base结构体 参考} 2 | \label{structRunnable_1_1functor__base}\index{Runnable\+::functor\+\_\+base@{Runnable\+::functor\+\_\+base}} 3 | 4 | 5 | 函数包装器虚基类 6 | 7 | 8 | 9 | 10 | {\ttfamily \#include $<$runnable.\+hpp$>$} 11 | 12 | 13 | 14 | 类 Runnable\+:\+:functor\+\_\+base 继承关系图\+:\nopagebreak 15 | \begin{figure}[H] 16 | \begin{center} 17 | \leavevmode 18 | \includegraphics[width=206pt]{structRunnable_1_1functor__base__inherit__graph} 19 | \end{center} 20 | \end{figure} 21 | \subsection*{Public 成员函数} 22 | \begin{DoxyCompactItemize} 23 | \item 24 | \mbox{\Hypertarget{structRunnable_1_1functor__base_ab43e3c0a0e9f697ff88ec5f1e3256756}\label{structRunnable_1_1functor__base_ab43e3c0a0e9f697ff88ec5f1e3256756}} 25 | virtual void {\bfseries call} ()=0 26 | \end{DoxyCompactItemize} 27 | 28 | 29 | \subsection{详细描述} 30 | 函数包装器虚基类 31 | 32 | 该结构体的文档由以下文件生成\+:\begin{DoxyCompactItemize} 33 | \item 34 | runnable.\+hpp\end{DoxyCompactItemize} 35 | -------------------------------------------------------------------------------- /doc/html/search/all_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['idle_5f',['idle_',['../classThread.html#a13aa04a60328060dec3a25b286c933a2',1,'Thread']]], 4 | ['initialdelay_5f',['initialDelay_',['../structTimerTask.html#af49a805f814a0b92e1f96037226a2d2e',1,'TimerTask']]], 5 | ['interval_5f',['interval_',['../structTimerTask.html#afd954f592d96d8abe152e0f54b30979e',1,'TimerTask']]], 6 | ['is_5fempty',['is_empty',['../classBlockingQueue.html#a06f9211f5225bb6413f403e8d14ca7ce',1,'BlockingQueue']]], 7 | ['isidle',['isIdle',['../classThread.html#acb6c590deecea4778a855459f080060a',1,'Thread']]], 8 | ['isrunning',['isRunning',['../classThread.html#ab4c718f3ca4aa7514c7e89e38f9da894',1,'Thread::isRunning()'],['../classThreadPoolExecutor.html#a841ae2189d6f85b9df9f69dec5375341',1,'ThreadPoolExecutor::isRunning()']]], 9 | ['isshutdown',['isShutDown',['../classThreadPoolExecutor.html#ac33c356670eabe5345992331e615348c',1,'ThreadPoolExecutor']]], 10 | ['isterminated',['isTerminated',['../classThreadPoolExecutor.html#a89ed68d6c67ad6fbde73b7883c8107a7',1,'ThreadPoolExecutor']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /doc/html/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_f.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/classes_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/classes_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/classes_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/classes_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/classes_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/classes_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/classes_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/typedefs_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_f.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/variables_d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
载入中...
12 |
13 | 16 |
搜索中...
17 |
未找到
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/html/search/all_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getactivecount',['getActiveCount',['../classThreadPoolExecutor.html#ac9345329aa167200bec31951d2f5a690',1,'ThreadPoolExecutor']]], 4 | ['getcorepoolsize',['getCorePoolSize',['../classThreadPoolExecutor.html#af29377a50af53031bb06aeacf9ef27f7',1,'ThreadPoolExecutor']]], 5 | ['geteverpoolsize',['getEverPoolSize',['../classThreadPoolExecutor.html#af630e5117b4f67428a4fcbee5c15a7d9',1,'ThreadPoolExecutor']]], 6 | ['getlastactivetime',['getLastActiveTime',['../classThread.html#a23de6830557bdbe18a0baf17db58aec6',1,'Thread']]], 7 | ['getname',['getName',['../classThread.html#a19bc237f8a86727a5a4b516122fe20f6',1,'Thread']]], 8 | ['getpid',['getPid',['../classThread.html#ad7fd4dfa0edff93d118b2edf5ab7be2c',1,'Thread']]], 9 | ['getprio',['getPrio',['../classThread.html#a712ab58b9e89f458427b213b1197a666',1,'Thread']]], 10 | ['gettaskcount',['getTaskCount',['../classScheduledThreadPoolExecutor.html#a786bc8478d265dfe0288de9397c7f768',1,'ScheduledThreadPoolExecutor::getTaskCount()'],['../classThreadPoolExecutor.html#a61e8321202e6b0f6ea014485e8e10450',1,'ThreadPoolExecutor::getTaskCount()']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /doc/html/search/functions_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getactivecount',['getActiveCount',['../classThreadPoolExecutor.html#ac9345329aa167200bec31951d2f5a690',1,'ThreadPoolExecutor']]], 4 | ['getcorepoolsize',['getCorePoolSize',['../classThreadPoolExecutor.html#af29377a50af53031bb06aeacf9ef27f7',1,'ThreadPoolExecutor']]], 5 | ['geteverpoolsize',['getEverPoolSize',['../classThreadPoolExecutor.html#af630e5117b4f67428a4fcbee5c15a7d9',1,'ThreadPoolExecutor']]], 6 | ['getlastactivetime',['getLastActiveTime',['../classThread.html#a23de6830557bdbe18a0baf17db58aec6',1,'Thread']]], 7 | ['getname',['getName',['../classThread.html#a19bc237f8a86727a5a4b516122fe20f6',1,'Thread']]], 8 | ['getpid',['getPid',['../classThread.html#ad7fd4dfa0edff93d118b2edf5ab7be2c',1,'Thread']]], 9 | ['getprio',['getPrio',['../classThread.html#a712ab58b9e89f458427b213b1197a666',1,'Thread']]], 10 | ['gettaskcount',['getTaskCount',['../classScheduledThreadPoolExecutor.html#a786bc8478d265dfe0288de9397c7f768',1,'ScheduledThreadPoolExecutor::getTaskCount()'],['../classThreadPoolExecutor.html#a61e8321202e6b0f6ea014485e8e10450',1,'ThreadPoolExecutor::getTaskCount()']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /doc/latex/classRWLock.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{classRWLock}{}\section{R\+W\+Lock类 参考} 2 | \label{classRWLock}\index{R\+W\+Lock@{R\+W\+Lock}} 3 | \subsection*{Public 成员函数} 4 | \begin{DoxyCompactItemize} 5 | \item 6 | \mbox{\Hypertarget{classRWLock_a1ccd8fe0bf4931521e08df92f4662b2a}\label{classRWLock_a1ccd8fe0bf4931521e08df92f4662b2a}} 7 | int {\bfseries rd\+Lock} () 8 | \item 9 | \mbox{\Hypertarget{classRWLock_a6b034d61e35cce6702f284110f33ebdb}\label{classRWLock_a6b034d61e35cce6702f284110f33ebdb}} 10 | int {\bfseries wr\+Lock} () 11 | \item 12 | \mbox{\Hypertarget{classRWLock_ace8dce3640aa69fac39229a1096f064f}\label{classRWLock_ace8dce3640aa69fac39229a1096f064f}} 13 | int {\bfseries unlock} () 14 | \item 15 | \mbox{\Hypertarget{classRWLock_add87a7653a66092f1584fba8e3d75bc2}\label{classRWLock_add87a7653a66092f1584fba8e3d75bc2}} 16 | int {\bfseries try\+Rd\+Lock} () 17 | \item 18 | \mbox{\Hypertarget{classRWLock_a6a1b5fddaede8469cd774f20a93d7136}\label{classRWLock_a6a1b5fddaede8469cd774f20a93d7136}} 19 | int {\bfseries try\+Wr\+Lock} () 20 | \end{DoxyCompactItemize} 21 | 22 | 23 | 该类的文档由以下文件生成\+:\begin{DoxyCompactItemize} 24 | \item 25 | rwlock.\+hpp\end{DoxyCompactItemize} 26 | -------------------------------------------------------------------------------- /example/test09.cpp: -------------------------------------------------------------------------------- 1 | //使用BlockingQueue替换 2 | //BlockingQueue 3 | //Runnable测试 4 | #include 5 | #include 6 | #include "runnable.hpp" 7 | #include "threadpool.hpp" 8 | 9 | class R: public Runnable { 10 | public: 11 | virtual void operator()() { 12 | std::cout << "需要重写operator" << std::endl; 13 | name += "l"; 14 | } 15 | 16 | public: 17 | std::string getName()const { 18 | return name; 19 | } 20 | 21 | private: 22 | std::string name = "R"; 23 | }; 24 | 25 | int main(void) 26 | { 27 | ThreadPoolExecutor tpe(1, 2); 28 | std::cout << "main--" << syscall(__NR_gettid) << std::endl; 29 | 30 | Runnable r1([]() { 31 | std::cout << "r1" << std::endl; 32 | }); 33 | r1(); 34 | 35 | //拷贝构造不会复制functor_ 36 | //通过构造函数传递的lambda不会被拷贝 37 | Runnable r2(r1); 38 | r2(); 39 | 40 | //使用shared_ptr可以保存运行后的结果 41 | auto rsp = std::make_shared(); 42 | tpe.execute(rsp); 43 | 44 | sleep(1); 45 | //刚刚提交的任务有可能不会立即执行,需要等待 46 | std::cout << "R-name: " << rsp->getName() << std::endl; 47 | tpe.releaseNonCoreThreads(); 48 | tpe.shutdown(); 49 | tpe.stop(); 50 | std::cout << tpe.toString() << std::endl; 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /doc/latex/hierarchy.tex: -------------------------------------------------------------------------------- 1 | \section{类继承关系} 2 | 此继承关系列表按字典顺序粗略的排序\+: \begin{DoxyCompactList} 3 | \item \contentsline{section}{Blocking\+Queue$<$ T $>$}{\pageref{classBlockingQueue}}{} 4 | \item \contentsline{section}{Functor\+\_\+base}{\pageref{structFunctor__base}}{} 5 | \begin{DoxyCompactList} 6 | \item \contentsline{section}{Functor\+\_\+t$<$ F $>$}{\pageref{structFunctor__t}}{} 7 | \end{DoxyCompactList} 8 | \item \contentsline{section}{Rejected\+Execution\+Handler}{\pageref{classRejectedExecutionHandler}}{} 9 | \item \contentsline{section}{Runnable}{\pageref{classRunnable}}{} 10 | \begin{DoxyCompactList} 11 | \item \contentsline{section}{Timer\+Task}{\pageref{structTimerTask}}{} 12 | \end{DoxyCompactList} 13 | \item \contentsline{section}{R\+W\+Lock}{\pageref{classRWLock}}{} 14 | \item \contentsline{section}{Semaphore}{\pageref{classSemaphore}}{} 15 | \item \contentsline{section}{Thread}{\pageref{classThread}}{} 16 | \item \contentsline{section}{Thread\+Pool\+Executor}{\pageref{classThreadPoolExecutor}}{} 17 | \begin{DoxyCompactList} 18 | \item \contentsline{section}{Scheduled\+Thread\+Pool\+Executor}{\pageref{classScheduledThreadPoolExecutor}}{} 19 | \item \contentsline{section}{Work\+Stealing\+Thread\+Pool\+Executor}{\pageref{classWorkStealingThreadPoolExecutor}}{} 20 | \end{DoxyCompactList} 21 | \end{DoxyCompactList} 22 | -------------------------------------------------------------------------------- /doc/latex/classinterrupt__flag.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{classinterrupt__flag}{}\section{interrupt\+\_\+flag类 参考} 2 | \label{classinterrupt__flag}\index{interrupt\+\_\+flag@{interrupt\+\_\+flag}} 3 | 4 | 5 | 线程中断要使用的类,未完成 6 | 7 | 8 | 9 | 10 | {\ttfamily \#include $<$interruptthread.\+hpp$>$} 11 | 12 | \subsection*{Public 成员函数} 13 | \begin{DoxyCompactItemize} 14 | \item 15 | \mbox{\Hypertarget{classinterrupt__flag_a2a97873c0f9ee0ee81ee4b9f3917b274}\label{classinterrupt__flag_a2a97873c0f9ee0ee81ee4b9f3917b274}} 16 | void {\bfseries set} () 17 | \item 18 | \mbox{\Hypertarget{classinterrupt__flag_aee5d0cee6b88df285edaf1f418ef366e}\label{classinterrupt__flag_aee5d0cee6b88df285edaf1f418ef366e}} 19 | bool {\bfseries is\+\_\+set} () const 20 | \item 21 | \mbox{\Hypertarget{classinterrupt__flag_aef4001274efffb0ff9bcfe7c0d0f4077}\label{classinterrupt__flag_aef4001274efffb0ff9bcfe7c0d0f4077}} 22 | void {\bfseries set\+\_\+condition\+\_\+variable} (std\+::condition\+\_\+variable \&cv) 23 | \item 24 | \mbox{\Hypertarget{classinterrupt__flag_a9d9c6d923ff61f653697fa7bd51e2e37}\label{classinterrupt__flag_a9d9c6d923ff61f653697fa7bd51e2e37}} 25 | void {\bfseries clear\+\_\+condition\+\_\+variable} () 26 | \end{DoxyCompactItemize} 27 | 28 | 29 | \subsection{详细描述} 30 | 线程中断要使用的类,未完成 31 | 32 | 该类的文档由以下文件生成\+:\begin{DoxyCompactItemize} 33 | \item 34 | interruptthread.\+hpp\end{DoxyCompactItemize} 35 | -------------------------------------------------------------------------------- /example/test05.cpp: -------------------------------------------------------------------------------- 1 | //测试releaseNonCoreThreads,以及线程动态增加方法 2 | #include 3 | #include 4 | #include "runnable.hpp" 5 | #include "threadpool.hpp" 6 | 7 | int main(void) 8 | { 9 | ThreadPoolExecutor tpe(1, 2); 10 | //tpe.preStartCoreThreads(); 11 | tpe.submit([]() { 12 | std::cout << "task01" << "--tid : " << syscall(__NR_gettid) << std::endl; 13 | }); 14 | tpe.keepNonCoreThreadAlive(true); 15 | 16 | //std::this_thread::sleep_for(std::chrono::seconds(1)); 17 | 18 | tpe.submit([]() { 19 | std::cout << "task02" << "--tid : " << syscall(__NR_gettid) << std::endl; 20 | }, false); 21 | 22 | tpe.submit([]() { 23 | std::cout << "task03" << "--tid : " << syscall(__NR_gettid) << std::endl; 24 | }, false); 25 | 26 | //让非核心线程退出, 27 | //tpe.releaseNonCoreThreads(); 28 | 29 | tpe.submit([]() { 30 | std::cout << "task04" << "--tid : " << syscall(__NR_gettid) << std::endl; 31 | }, false); 32 | 33 | tpe.submit([]() { 34 | std::cout << "task05" << "--tid : " << syscall(__NR_gettid) << std::endl; 35 | }, false); 36 | 37 | tpe.submit([]() { 38 | std::cout << "task06" << "--tid : " << syscall(__NR_gettid) << std::endl; 39 | }); 40 | 41 | tpe.submit([]() { 42 | std::cout << "task07" << "--tid : " << syscall(__NR_gettid) << std::endl; 43 | }); 44 | 45 | sleep(3); 46 | std::cout << tpe.toString() << std::endl; 47 | tpe.stop(); 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /example/test04.cpp: -------------------------------------------------------------------------------- 1 | //测试operator()() 2 | #include 3 | #include 4 | #include "runnable.hpp" 5 | #include "threadpool.hpp" 6 | 7 | class R: public Runnable { 8 | public: 9 | virtual void operator()() { 10 | std::cout << "Runnable" << "--R" << std::endl; 11 | } 12 | }; 13 | 14 | void test(int a) { 15 | std::cout << "a = " << a << std::endl; 16 | } 17 | 18 | int main(void) 19 | { 20 | std::cout << "main--" << syscall(__NR_gettid) << std::endl; 21 | 22 | R r1; 23 | auto r2 = std::make_shared(); 24 | 25 | ThreadPoolExecutor tpe(1, 2); 26 | for (int i = 0; i < 1; ++i) { 27 | tpe.submit([]() { 28 | std::cout << syscall(__NR_gettid) << std::endl; 29 | }); 30 | tpe.submit([]()->int { 31 | std::cout << syscall(__NR_gettid) << std::endl; 32 | return 999; 33 | }); 34 | } 35 | 36 | //测试std::bind 37 | Runnable r3(std::bind(test, 10)); 38 | r3(); 39 | 40 | //测试execute--execute对Runnable使用std::move, 41 | //原来的Runnable的对象将会不存在 42 | //对于std::shared_ptr不会使用std::move 43 | tpe.execute(r1); 44 | //无效操作 45 | r1(); 46 | //使用std::shared_ptr 47 | tpe.execute(r2); 48 | //有效操作 49 | r2->operator()(); 50 | 51 | tpe.submit([]() ->int { 52 | std::cout << syscall(__NR_gettid) << std::endl; 53 | return 999; 54 | }, false); 55 | 56 | sleep(1); 57 | tpe.shutdown(); 58 | tpe.stop(); 59 | std::cout << tpe.toString() << std::endl; 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /doc/html/search/all_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['call',['call',['../structFunctor__t.html#ab4fc359c4f5955cc2d6a86214a5545ce',1,'Functor_t']]], 4 | ['calltime_5f',['callTime_',['../structTimerTask.html#a7bcf4dfd5b91038d4c4c5378285d4ed0',1,'TimerTask']]], 5 | ['capacity',['CAPACITY',['../classThreadPoolExecutor.html#aac96b726327ad0d07709085ab49c4f58',1,'ThreadPoolExecutor']]], 6 | ['compareanddecrementworkercount',['compareAndDecrementWorkerCount',['../classThreadPoolExecutor.html#ac40053b88cd669526a0a6225b5e1a86e',1,'ThreadPoolExecutor']]], 7 | ['compareandincrementworkercount',['compareAndIncrementWorkerCount',['../classThreadPoolExecutor.html#ac1bcafe65f800aeb9feade5f31b64fde',1,'ThreadPoolExecutor']]], 8 | ['corepoolsize_5f',['corePoolSize_',['../classThreadPoolExecutor.html#ac4496adc7a7ff18b97464a863fcf4a73',1,'ThreadPoolExecutor']]], 9 | ['coreworkerthread',['coreWorkerThread',['../classThreadPoolExecutor.html#a5e40839bf4191b5eab9d81227ddb62c3',1,'ThreadPoolExecutor::coreWorkerThread()'],['../classWorkStealingThreadPoolExecutor.html#a9a9ad791af26c0809a9e1864544930aa',1,'WorkStealingThreadPoolExecutor::coreWorkerThread()']]], 10 | ['count_5fbits',['COUNT_BITS',['../classThreadPoolExecutor.html#af82bff422304406f59a14b5b638c2b42',1,'ThreadPoolExecutor']]], 11 | ['ctl_5f',['ctl_',['../classThreadPoolExecutor.html#a010113b7aac17ef364d417c485263873',1,'ThreadPoolExecutor']]], 12 | ['ctlof',['ctlOf',['../classThreadPoolExecutor.html#a31ed7a73571c79c8dbb486f27a4df4eb',1,'ThreadPoolExecutor']]], 13 | ['currentpid_5f',['currentPid_',['../classThread.html#a0c0878a96696bbb092a69bc2f1f812fd',1,'Thread']]] 14 | ]; 15 | -------------------------------------------------------------------------------- /doc/html/search/functions_f.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['wait',['wait',['../classSemaphore.html#ab50da3ab3fdc7f56acc85cbdf248c98d',1,'Semaphore']]], 4 | ['wait_5fand_5fpop',['wait_and_pop',['../classBlockingQueue.html#a8efc43c38666a38402c39f772da63fcf',1,'BlockingQueue']]], 5 | ['workercountof',['workerCountOf',['../classThreadPoolExecutor.html#a4f842d070a584bbc16a693207a947aac',1,'ThreadPoolExecutor']]], 6 | ['workerthread',['workerThread',['../classThreadPoolExecutor.html#a844902ce61fb16b11a569b8ee56e80e9',1,'ThreadPoolExecutor::workerThread()'],['../classWorkStealingThreadPoolExecutor.html#a962c0965822cd961984928ec26d61d4e',1,'WorkStealingThreadPoolExecutor::workerThread()']]], 7 | ['workstealingthreadpoolexecutor',['WorkStealingThreadPoolExecutor',['../classWorkStealingThreadPoolExecutor.html#a3e4e9fd05b5b325f2f051725410525cb',1,'WorkStealingThreadPoolExecutor::WorkStealingThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, const RejectedExecutionHandler &handler, const std::string &prefix="")'],['../classWorkStealingThreadPoolExecutor.html#a80c8e32259e498cbb2c5625b272d37f3',1,'WorkStealingThreadPoolExecutor::WorkStealingThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, RejectedExecutionHandler *handler, const std::string &prefix="")'],['../classWorkStealingThreadPoolExecutor.html#adb702388a229cc2a0508901976dd9104',1,'WorkStealingThreadPoolExecutor::WorkStealingThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::string &prefix="")']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /doc/latex/annotated.tex: -------------------------------------------------------------------------------- 1 | \section{类列表} 2 | 这里列出了所有类、结构、联合以及接口定义等,并附带简要说明\+:\begin{DoxyCompactList} 3 | \item\contentsline{section}{\hyperlink{classBlockingQueue}{Blocking\+Queue$<$ T $>$} \\*\hyperlink{classBlockingQueue}{Blocking\+Queue} 阻塞队列(\+F\+I\+F\+O) }{\pageref{classBlockingQueue}}{} 4 | \item\contentsline{section}{\hyperlink{structFunctor__base}{Functor\+\_\+base} \\*函数包装器虚基类 }{\pageref{structFunctor__base}}{} 5 | \item\contentsline{section}{\hyperlink{structFunctor__t}{Functor\+\_\+t$<$ F $>$} }{\pageref{structFunctor__t}}{} 6 | \item\contentsline{section}{\hyperlink{classRejectedExecutionHandler}{Rejected\+Execution\+Handler} \\*不再接受任务时的拒绝策略 }{\pageref{classRejectedExecutionHandler}}{} 7 | \item\contentsline{section}{\hyperlink{classRunnable}{Runnable} \\*\hyperlink{classRunnable}{Runnable} interface 重写operator()或传进lambda }{\pageref{classRunnable}}{} 8 | \item\contentsline{section}{\hyperlink{classRWLock}{R\+W\+Lock} }{\pageref{classRWLock}}{} 9 | \item\contentsline{section}{\hyperlink{classScheduledThreadPoolExecutor}{Scheduled\+Thread\+Pool\+Executor} \\*定时任务调度线程池,最大线程数和核心线程数相等 }{\pageref{classScheduledThreadPoolExecutor}}{} 10 | \item\contentsline{section}{\hyperlink{classSemaphore}{Semaphore} \\*信号量 }{\pageref{classSemaphore}}{} 11 | \item\contentsline{section}{\hyperlink{classThread}{Thread} \\*C++11线程封装类,包含更丰富功能 }{\pageref{classThread}}{} 12 | \item\contentsline{section}{\hyperlink{classThreadPoolExecutor}{Thread\+Pool\+Executor} \\*线程池基本实现,每个线程都有一个任务队列 }{\pageref{classThreadPoolExecutor}}{} 13 | \item\contentsline{section}{\hyperlink{structTimerTask}{Timer\+Task} \\*定时任务封装 }{\pageref{structTimerTask}}{} 14 | \item\contentsline{section}{\hyperlink{classWorkStealingThreadPoolExecutor}{Work\+Stealing\+Thread\+Pool\+Executor} \\*任务窃取线程池,从下一个线程的任务队列窃取任务 }{\pageref{classWorkStealingThreadPoolExecutor}}{} 15 | \end{DoxyCompactList} 16 | -------------------------------------------------------------------------------- /doc/html/search/all_12.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['wait',['wait',['../classSemaphore.html#ab50da3ab3fdc7f56acc85cbdf248c98d',1,'Semaphore']]], 4 | ['wait_5fand_5fpop',['wait_and_pop',['../classBlockingQueue.html#a8efc43c38666a38402c39f772da63fcf',1,'BlockingQueue']]], 5 | ['workercountof',['workerCountOf',['../classThreadPoolExecutor.html#a4f842d070a584bbc16a693207a947aac',1,'ThreadPoolExecutor']]], 6 | ['workerthread',['workerThread',['../classThreadPoolExecutor.html#a844902ce61fb16b11a569b8ee56e80e9',1,'ThreadPoolExecutor::workerThread()'],['../classWorkStealingThreadPoolExecutor.html#a962c0965822cd961984928ec26d61d4e',1,'WorkStealingThreadPoolExecutor::workerThread()']]], 7 | ['workqueues_5f',['workQueues_',['../classThreadPoolExecutor.html#a415491f8f40c0fcb99e7ec25cdd209d0',1,'ThreadPoolExecutor']]], 8 | ['workstealingthreadpoolexecutor',['WorkStealingThreadPoolExecutor',['../classWorkStealingThreadPoolExecutor.html',1,'WorkStealingThreadPoolExecutor'],['../classWorkStealingThreadPoolExecutor.html#a3e4e9fd05b5b325f2f051725410525cb',1,'WorkStealingThreadPoolExecutor::WorkStealingThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, const RejectedExecutionHandler &handler, const std::string &prefix="")'],['../classWorkStealingThreadPoolExecutor.html#a80c8e32259e498cbb2c5625b272d37f3',1,'WorkStealingThreadPoolExecutor::WorkStealingThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, RejectedExecutionHandler *handler, const std::string &prefix="")'],['../classWorkStealingThreadPoolExecutor.html#adb702388a229cc2a0508901976dd9104',1,'WorkStealingThreadPoolExecutor::WorkStealingThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::string &prefix="")']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /doc/latex/structThread_1_1Func__t.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structThread_1_1Func__t}{}\section{Thread\+:\+:Func\+\_\+t$<$ Function\+Type $>$ 模板结构体 参考} 2 | \label{structThread_1_1Func__t}\index{Thread\+::\+Func\+\_\+t$<$ Function\+Type $>$@{Thread\+::\+Func\+\_\+t$<$ Function\+Type $>$}} 3 | 4 | 5 | 包装传进来的lambda函数 6 | 7 | 8 | 9 | 10 | {\ttfamily \#include $<$thread.\+hpp$>$} 11 | 12 | 13 | 14 | 类 Thread\+:\+:Func\+\_\+t$<$ Function\+Type $>$ 继承关系图\+:\nopagebreak 15 | \begin{figure}[H] 16 | \begin{center} 17 | \leavevmode 18 | \includegraphics[width=209pt]{structThread_1_1Func__t__inherit__graph} 19 | \end{center} 20 | \end{figure} 21 | 22 | 23 | Thread\+:\+:Func\+\_\+t$<$ Function\+Type $>$ 的协作图\+:\nopagebreak 24 | \begin{figure}[H] 25 | \begin{center} 26 | \leavevmode 27 | \includegraphics[width=209pt]{structThread_1_1Func__t__coll__graph} 28 | \end{center} 29 | \end{figure} 30 | \subsection*{Public 成员函数} 31 | \begin{DoxyCompactItemize} 32 | \item 33 | \mbox{\Hypertarget{structThread_1_1Func__t_af347c7e04169f92be6aff37d1d3d3a6b}\label{structThread_1_1Func__t_af347c7e04169f92be6aff37d1d3d3a6b}} 34 | {\bfseries Func\+\_\+t} (Function\+Type \&\&f) 35 | \item 36 | \mbox{\Hypertarget{structThread_1_1Func__t_a2b6b3d0e5cd2889f589fec59782de255}\label{structThread_1_1Func__t_a2b6b3d0e5cd2889f589fec59782de255}} 37 | void {\bfseries call} () override 38 | \end{DoxyCompactItemize} 39 | \subsection*{Public 属性} 40 | \begin{DoxyCompactItemize} 41 | \item 42 | \mbox{\Hypertarget{structThread_1_1Func__t_ab783414e8bbebf0e9ac0a7a5576be54c}\label{structThread_1_1Func__t_ab783414e8bbebf0e9ac0a7a5576be54c}} 43 | Function\+Type {\bfseries \+\_\+f} 44 | \end{DoxyCompactItemize} 45 | 46 | 47 | \subsection{详细描述} 48 | \subsubsection*{template$<$typename Function\+Type$>$\newline 49 | struct Thread\+::\+Func\+\_\+t$<$ Function\+Type $>$} 50 | 51 | 包装传进来的lambda函数 52 | 53 | 该结构体的文档由以下文件生成\+:\begin{DoxyCompactItemize} 54 | \item 55 | thread.\+hpp\end{DoxyCompactItemize} 56 | -------------------------------------------------------------------------------- /include/semaphore.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SEMAPHORE_HPP 2 | #define SEMAPHORE_HPP 3 | 4 | #include 5 | #include 6 | 7 | /** 8 | * @brief 信号量 9 | */ 10 | class Semaphore { 11 | private: 12 | sem_t sem_; 13 | 14 | public: 15 | /** 16 | * @brief post 信号量加一 17 | * 18 | * @return 错误码 0表示成功 19 | */ 20 | int post() { 21 | return sem_post(&sem_); 22 | } 23 | 24 | /** 25 | * @brief wait 信号量减一 26 | * 27 | * @return 错误码 0表示成功 28 | */ 29 | int wait() { 30 | return sem_wait(&sem_); 31 | } 32 | 33 | /** 34 | * @brief tryWait 信号量减一,立即返回 35 | * 36 | * @return 错误码 0表示成功 37 | */ 38 | int tryWait() { 39 | return sem_trywait(&sem_); 40 | } 41 | 42 | /** 43 | * @brief timedWait 信号量减一 44 | * 45 | * @param seconds 等待时间-秒 46 | * @param nanoseconds 等待时间-纳秒 47 | * 48 | * @return 错误码 0表示成功 49 | */ 50 | int timedWait(unsigned int seconds, unsigned int nanoseconds) { 51 | timespec ts{seconds, nanoseconds}; 52 | return sem_timedwait(&sem_, &ts); 53 | } 54 | 55 | public: 56 | /** 57 | * @brief Semaphore 构造函数 58 | * 59 | * @param initSize 信号量初值 60 | */ 61 | Semaphore(unsigned int initSize = 0) { 62 | sem_init(&sem_, 0, initSize); 63 | } 64 | /** 65 | * @brief ~Semaphore 析构函数 66 | */ 67 | virtual ~Semaphore () { 68 | sem_destroy(&sem_); 69 | } 70 | 71 | Semaphore(const Semaphore&) = delete; 72 | Semaphore(const Semaphore&&) = delete; 73 | Semaphore& operator=(const Semaphore&) = delete; 74 | Semaphore& operator=(const Semaphore&&) = delete; 75 | }; 76 | 77 | #endif /* SEMAPHORE_HPP */ 78 | -------------------------------------------------------------------------------- /doc/html/menu.js: -------------------------------------------------------------------------------- 1 | function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { 2 | function makeTree(data,relPath) { 3 | var result=''; 4 | if ('children' in data) { 5 | result+=''; 12 | } 13 | return result; 14 | } 15 | 16 | $('#main-nav').append(makeTree(menudata,relPath)); 17 | $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); 18 | if (searchEnabled) { 19 | if (serverSide) { 20 | $('#main-menu').append('
  • '); 21 | } else { 22 | $('#main-menu').append('
  • '); 23 | } 24 | } 25 | $('#main-menu').smartmenus(); 26 | } 27 | -------------------------------------------------------------------------------- /doc/html/search/functions_c.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['reject',['reject',['../classThreadPoolExecutor.html#a14c4e3d786dcf22e858b11a95d2f77ef',1,'ThreadPoolExecutor::reject(const Runnable &command) final'],['../classThreadPoolExecutor.html#a353e65b77bb3c0950ed79939473d4852',1,'ThreadPoolExecutor::reject(const Runnable::sptr command) final']]], 4 | ['rejectedexecution',['rejectedExecution',['../classRejectedExecutionHandler.html#a18d3240b63ffa8a84fa728f89c2ef1d1',1,'RejectedExecutionHandler::rejectedExecution(const Runnable::sptr r)'],['../classRejectedExecutionHandler.html#abb6476c7d64a7bd3111fc1a39829858b',1,'RejectedExecutionHandler::rejectedExecution(const Runnable &r)']]], 5 | ['rejectedexecutionhandler',['RejectedExecutionHandler',['../classRejectedExecutionHandler.html#ac288960546b34a9f0e7be49c32d2f929',1,'RejectedExecutionHandler']]], 6 | ['releasenoncorethreads',['releaseNonCoreThreads',['../classThreadPoolExecutor.html#a280379699ff72325cc4ccaf491e50967',1,'ThreadPoolExecutor']]], 7 | ['releaseworkers',['releaseWorkers',['../classThreadPoolExecutor.html#a7d4bfa422c41a11fcdd33e7a1b2bcec8',1,'ThreadPoolExecutor']]], 8 | ['run',['run',['../classThread.html#a7574ff300357f9d3193db03b83937eac',1,'Thread']]], 9 | ['runnable',['Runnable',['../classRunnable.html#ab052afa8b53dd1e7c28e978962839446',1,'Runnable::Runnable(F &&f)'],['../classRunnable.html#a6d6ce997a7873530a2f339412e6c4935',1,'Runnable::Runnable(Runnable &&rh)'],['../classRunnable.html#a9e4d88b5d30d6e0368c5d22a0df203ee',1,'Runnable::Runnable(Runnable &rh)'],['../classRunnable.html#a5769222dcc4b2adca7723bfbdfa00cbb',1,'Runnable::Runnable()=default']]], 10 | ['runstateatleast',['runStateAtLeast',['../classThreadPoolExecutor.html#a44ee48ed44faa12fc6373074e9059e4e',1,'ThreadPoolExecutor']]], 11 | ['runstatelessthan',['runStateLessThan',['../classThreadPoolExecutor.html#aa12a3efb879080453fb7abc486585698',1,'ThreadPoolExecutor']]], 12 | ['runstateof',['runStateOf',['../classThreadPoolExecutor.html#acdb626fdcb6ed4c7822508d1e0a3fcf5',1,'ThreadPoolExecutor']]] 13 | ]; 14 | -------------------------------------------------------------------------------- /doc/latex/classRejectedExecutionHandler.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{classRejectedExecutionHandler}{}\section{Rejected\+Execution\+Handler类 参考} 2 | \label{classRejectedExecutionHandler}\index{Rejected\+Execution\+Handler@{Rejected\+Execution\+Handler}} 3 | 4 | 5 | 不再接受任务时的拒绝策略 6 | 7 | 8 | 9 | 10 | {\ttfamily \#include $<$threadpoolexecutor.\+hpp$>$} 11 | 12 | \subsection*{Public 成员函数} 13 | \begin{DoxyCompactItemize} 14 | \item 15 | \mbox{\Hypertarget{classRejectedExecutionHandler_ac288960546b34a9f0e7be49c32d2f929}\label{classRejectedExecutionHandler_ac288960546b34a9f0e7be49c32d2f929}} 16 | \hyperlink{classRejectedExecutionHandler_ac288960546b34a9f0e7be49c32d2f929}{Rejected\+Execution\+Handler} ()=default 17 | \begin{DoxyCompactList}\small\item\em \hyperlink{classRejectedExecutionHandler}{Rejected\+Execution\+Handler} 构造函数 \end{DoxyCompactList}\item 18 | \mbox{\Hypertarget{classRejectedExecutionHandler_a640bb013143221dd4729b270da83ec5e}\label{classRejectedExecutionHandler_a640bb013143221dd4729b270da83ec5e}} 19 | virtual \hyperlink{classRejectedExecutionHandler_a640bb013143221dd4729b270da83ec5e}{$\sim$\+Rejected\+Execution\+Handler} ()=default 20 | \begin{DoxyCompactList}\small\item\em $\sim$\+Rejected\+Execution\+Handler 析构函数 \end{DoxyCompactList}\item 21 | \mbox{\Hypertarget{classRejectedExecutionHandler_a18d3240b63ffa8a84fa728f89c2ef1d1}\label{classRejectedExecutionHandler_a18d3240b63ffa8a84fa728f89c2ef1d1}} 22 | virtual void \hyperlink{classRejectedExecutionHandler_a18d3240b63ffa8a84fa728f89c2ef1d1}{rejected\+Execution} (const \hyperlink{classRunnable_abe8d3066c7305401d6f0aad8e70780f2}{Runnable\+::sptr} r) 23 | \begin{DoxyCompactList}\small\item\em 拒绝策略的执行函数 \end{DoxyCompactList}\item 24 | \mbox{\Hypertarget{classRejectedExecutionHandler_abb6476c7d64a7bd3111fc1a39829858b}\label{classRejectedExecutionHandler_abb6476c7d64a7bd3111fc1a39829858b}} 25 | virtual void \hyperlink{classRejectedExecutionHandler_abb6476c7d64a7bd3111fc1a39829858b}{rejected\+Execution} (const \hyperlink{classRunnable}{Runnable} \&r) 26 | \begin{DoxyCompactList}\small\item\em 拒绝策略的执行函数 \end{DoxyCompactList}\end{DoxyCompactItemize} 27 | 28 | 29 | \subsection{详细描述} 30 | 不再接受任务时的拒绝策略 31 | 32 | 该类的文档由以下文件生成\+:\begin{DoxyCompactItemize} 33 | \item 34 | threadpoolexecutor.\+hpp\end{DoxyCompactItemize} 35 | -------------------------------------------------------------------------------- /doc/latex/structFunctor__t.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structFunctor__t}{}\section{Functor\+\_\+t$<$ F $>$ 模板结构体 参考} 2 | \label{structFunctor__t}\index{Functor\+\_\+t$<$ F $>$@{Functor\+\_\+t$<$ F $>$}} 3 | 4 | 5 | 类 Functor\+\_\+t$<$ F $>$ 继承关系图\+: 6 | \nopagebreak 7 | \begin{figure}[H] 8 | \begin{center} 9 | \leavevmode 10 | \includegraphics[width=162pt]{structFunctor__t__inherit__graph} 11 | \end{center} 12 | \end{figure} 13 | 14 | 15 | Functor\+\_\+t$<$ F $>$ 的协作图\+: 16 | \nopagebreak 17 | \begin{figure}[H] 18 | \begin{center} 19 | \leavevmode 20 | \includegraphics[width=162pt]{structFunctor__t__coll__graph} 21 | \end{center} 22 | \end{figure} 23 | \subsection*{Public 成员函数} 24 | \begin{DoxyCompactItemize} 25 | \item 26 | \hyperlink{structFunctor__t_a1e788b8c1022f99a0e80b334b31383a2}{Functor\+\_\+t} (F \&\&f) 27 | \begin{DoxyCompactList}\small\item\em functor\+\_\+t 构造函数 \end{DoxyCompactList}\item 28 | \mbox{\Hypertarget{structFunctor__t_ab4fc359c4f5955cc2d6a86214a5545ce}\label{structFunctor__t_ab4fc359c4f5955cc2d6a86214a5545ce}} 29 | void \hyperlink{structFunctor__t_ab4fc359c4f5955cc2d6a86214a5545ce}{call} () override 30 | \begin{DoxyCompactList}\small\item\em call 执行被包装的函数 \end{DoxyCompactList}\end{DoxyCompactItemize} 31 | \subsection*{Public 属性} 32 | \begin{DoxyCompactItemize} 33 | \item 34 | \mbox{\Hypertarget{structFunctor__t_a3fe63a336dc5daebf87bdc39090caa7a}\label{structFunctor__t_a3fe63a336dc5daebf87bdc39090caa7a}} 35 | F {\bfseries f\+\_\+} 36 | \end{DoxyCompactItemize} 37 | 38 | 39 | \subsection{构造及析构函数说明} 40 | \mbox{\Hypertarget{structFunctor__t_a1e788b8c1022f99a0e80b334b31383a2}\label{structFunctor__t_a1e788b8c1022f99a0e80b334b31383a2}} 41 | \index{Functor\+\_\+t@{Functor\+\_\+t}!Functor\+\_\+t@{Functor\+\_\+t}} 42 | \index{Functor\+\_\+t@{Functor\+\_\+t}!Functor\+\_\+t@{Functor\+\_\+t}} 43 | \subsubsection{\texorpdfstring{Functor\+\_\+t()}{Functor\_t()}} 44 | {\footnotesize\ttfamily template$<$typename F $>$ \\ 45 | \hyperlink{structFunctor__t}{Functor\+\_\+t}$<$ F $>$\+::\hyperlink{structFunctor__t}{Functor\+\_\+t} (\begin{DoxyParamCaption}\item[{F \&\&}]{f }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}} 46 | 47 | 48 | 49 | functor\+\_\+t 构造函数 50 | 51 | 52 | \begin{DoxyParams}{参数} 53 | {\em std\+::move(f)} & 包装的函数 \\ 54 | \hline 55 | \end{DoxyParams} 56 | 57 | 58 | 该结构体的文档由以下文件生成\+:\begin{DoxyCompactItemize} 59 | \item 60 | functor\+\_\+wrapper.\+hpp\end{DoxyCompactItemize} 61 | -------------------------------------------------------------------------------- /doc/html/search/functions_d.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['schedule',['schedule',['../classScheduledThreadPoolExecutor.html#a45e622833714db87a86d50eb45c8f338',1,'ScheduledThreadPoolExecutor::schedule(F f, const std::chrono::nanoseconds &delay)'],['../classScheduledThreadPoolExecutor.html#a30f723414e619a950f1efd968d13921d',1,'ScheduledThreadPoolExecutor::schedule(const std::shared_ptr< TimerTask > &f)']]], 4 | ['scheduleatfixeddelay',['scheduleAtFixedDelay',['../classScheduledThreadPoolExecutor.html#a594bb3111f9d051ad12f366a13a54db0',1,'ScheduledThreadPoolExecutor']]], 5 | ['scheduleatfixedrate',['scheduleAtFixedRate',['../classScheduledThreadPoolExecutor.html#aebcb96fcb3f5bfc6e55ffcef9f38d60b',1,'ScheduledThreadPoolExecutor']]], 6 | ['scheduledthreadpoolexecutor',['ScheduledThreadPoolExecutor',['../classScheduledThreadPoolExecutor.html#a880b17439bcdcf9b7542925e24033691',1,'ScheduledThreadPoolExecutor']]], 7 | ['self',['self',['../classThread.html#a554185abbfacbcc4bf2e953cdddcbbba',1,'Thread']]], 8 | ['semaphore',['Semaphore',['../classSemaphore.html#a34841feb22e781d7d10ee7205f56bd8e',1,'Semaphore']]], 9 | ['setmaxpoolsize',['setMaxPoolSize',['../classThreadPoolExecutor.html#ac5a10d336958ca43530b31bff81c9c4b',1,'ThreadPoolExecutor']]], 10 | ['setname',['setName',['../classThread.html#ae816904b2a3e248472813e17c2b12a71',1,'Thread']]], 11 | ['setprio',['setPrio',['../classThread.html#a96661f80f5fbd26042a24eafd675cd91',1,'Thread']]], 12 | ['setrejectedexecutionhandler',['setRejectedExecutionHandler',['../classThreadPoolExecutor.html#a0a471dc0a68b70d99d8215565a4df688',1,'ThreadPoolExecutor']]], 13 | ['shutdown',['shutdown',['../classThreadPoolExecutor.html#aaa834c4350d6b12826803bb13dd467ea',1,'ThreadPoolExecutor']]], 14 | ['size',['size',['../classBlockingQueue.html#a733361d5721c6ba64af3e129921c43b0',1,'BlockingQueue']]], 15 | ['start',['start',['../classThread.html#a3a36451e02a15180624cdd88212cb1ba',1,'Thread']]], 16 | ['stdid',['stdId',['../classThread.html#a231da16ab1825ee982c4aa43f78c1b22',1,'Thread']]], 17 | ['stop',['stop',['../classThreadPoolExecutor.html#a588ec33baf402afd0e1c52b11d9234da',1,'ThreadPoolExecutor']]], 18 | ['submit',['submit',['../classThreadPoolExecutor.html#a94834ab6bedcc75111524fec4e928b3f',1,'ThreadPoolExecutor::submit()'],['../classWorkStealingThreadPoolExecutor.html#a7fa1b79c8be2b06a7952ccfd14aa7f6c',1,'WorkStealingThreadPoolExecutor::submit()']]] 19 | ]; 20 | -------------------------------------------------------------------------------- /doc/html/search/all_f.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['reject',['reject',['../classThreadPoolExecutor.html#a14c4e3d786dcf22e858b11a95d2f77ef',1,'ThreadPoolExecutor::reject(const Runnable &command) final'],['../classThreadPoolExecutor.html#a353e65b77bb3c0950ed79939473d4852',1,'ThreadPoolExecutor::reject(const Runnable::sptr command) final']]], 4 | ['rejectedexecution',['rejectedExecution',['../classRejectedExecutionHandler.html#a18d3240b63ffa8a84fa728f89c2ef1d1',1,'RejectedExecutionHandler::rejectedExecution(const Runnable::sptr r)'],['../classRejectedExecutionHandler.html#abb6476c7d64a7bd3111fc1a39829858b',1,'RejectedExecutionHandler::rejectedExecution(const Runnable &r)']]], 5 | ['rejectedexecutionhandler',['RejectedExecutionHandler',['../classRejectedExecutionHandler.html',1,'RejectedExecutionHandler'],['../classRejectedExecutionHandler.html#ac288960546b34a9f0e7be49c32d2f929',1,'RejectedExecutionHandler::RejectedExecutionHandler()']]], 6 | ['rejecthandler_5f',['rejectHandler_',['../classThreadPoolExecutor.html#a347041db412b03aa09dd4e9b3beaa391',1,'ThreadPoolExecutor']]], 7 | ['releasenoncorethreads',['releaseNonCoreThreads',['../classThreadPoolExecutor.html#a280379699ff72325cc4ccaf491e50967',1,'ThreadPoolExecutor']]], 8 | ['releaseworkers',['releaseWorkers',['../classThreadPoolExecutor.html#a7d4bfa422c41a11fcdd33e7a1b2bcec8',1,'ThreadPoolExecutor']]], 9 | ['run',['run',['../classThread.html#a7574ff300357f9d3193db03b83937eac',1,'Thread']]], 10 | ['runnable',['Runnable',['../classRunnable.html',1,'Runnable'],['../classRunnable.html#ab052afa8b53dd1e7c28e978962839446',1,'Runnable::Runnable(F &&f)'],['../classRunnable.html#a6d6ce997a7873530a2f339412e6c4935',1,'Runnable::Runnable(Runnable &&rh)'],['../classRunnable.html#a9e4d88b5d30d6e0368c5d22a0df203ee',1,'Runnable::Runnable(Runnable &rh)'],['../classRunnable.html#a5769222dcc4b2adca7723bfbdfa00cbb',1,'Runnable::Runnable()=default']]], 11 | ['running',['RUNNING',['../classThreadPoolExecutor.html#a9e28d5aa0cb4500921f7244565b8bed8',1,'ThreadPoolExecutor']]], 12 | ['runstateatleast',['runStateAtLeast',['../classThreadPoolExecutor.html#a44ee48ed44faa12fc6373074e9059e4e',1,'ThreadPoolExecutor']]], 13 | ['runstatelessthan',['runStateLessThan',['../classThreadPoolExecutor.html#aa12a3efb879080453fb7abc486585698',1,'ThreadPoolExecutor']]], 14 | ['runstateof',['runStateOf',['../classThreadPoolExecutor.html#acdb626fdcb6ed4c7822508d1e0a3fcf5',1,'ThreadPoolExecutor']]], 15 | ['rwlock',['RWLock',['../classRWLock.html',1,'']]] 16 | ]; 17 | -------------------------------------------------------------------------------- /doc/html/search/functions_e.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['take',['take',['../classBlockingQueue.html#aac788baea510940fc40961a285bacc5f',1,'BlockingQueue']]], 4 | ['terminated',['terminated',['../classThreadPoolExecutor.html#a61774315237123faf8e7fcc9d35ae47d',1,'ThreadPoolExecutor']]], 5 | ['thread',['Thread',['../classThread.html#a66350772ff3af06962db113658a72ae3',1,'Thread::Thread(int pro)'],['../classThread.html#a038819a1ef7bb4e50ae580d477f1a3b0',1,'Thread::Thread(const std::string &name="", int pro=20)'],['../classThread.html#a61efca5f0beb62628c515fb7cdef7e08',1,'Thread::Thread(FunctionType f, const std::string &name="", int pro=20)']]], 6 | ['threadpoolexecutor',['ThreadPoolExecutor',['../classThreadPoolExecutor.html#a212b34b7e25e9eba4e096473a1b81f9e',1,'ThreadPoolExecutor::ThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, const RejectedExecutionHandler &handler, const std::string &prefix="")'],['../classThreadPoolExecutor.html#ab750236e7b95489a1cb66d4b026717fc',1,'ThreadPoolExecutor::ThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, RejectedExecutionHandler *handler, const std::string &prefix="")'],['../classThreadPoolExecutor.html#a071bcc9eb42b365e2ce28a32938d422e',1,'ThreadPoolExecutor::ThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::string &prefix="")']]], 7 | ['timedwait',['timedWait',['../classSemaphore.html#a203e6b9f726ca5defc94379e9145278e',1,'Semaphore']]], 8 | ['timertask',['TimerTask',['../structTimerTask.html#ab87d7c5c62a8a079031b39eea3958c65',1,'TimerTask::TimerTask(const std::chrono::nanoseconds &initDelay, const std::chrono::nanoseconds &interval, bool fixedRate, F &&f)'],['../structTimerTask.html#a1b24917388958b16efb2d4d42593e96e',1,'TimerTask::TimerTask(const TimerTask &rh)'],['../structTimerTask.html#a028f1f4221afe88383ac3c17b4c1ea41',1,'TimerTask::TimerTask()=default']]], 9 | ['tostring',['toString',['../classScheduledThreadPoolExecutor.html#a4a785e058d76dc861a23904d7e1033f0',1,'ScheduledThreadPoolExecutor::toString()'],['../classThreadPoolExecutor.html#a8e340cec3bb976f7773db103d73189c2',1,'ThreadPoolExecutor::toString()']]], 10 | ['try_5fpop',['try_pop',['../classBlockingQueue.html#a47a2d7726112b4e2d7b3f65a4e84aa06',1,'BlockingQueue']]], 11 | ['trywait',['tryWait',['../classSemaphore.html#acc15178e43d33745f4acc6e2b2cccf9b',1,'Semaphore']]] 12 | ]; 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # C++11线程池 2 | 3 | `如果你想要一个简单实用的线程池请看这里`:https://github.com/yzz-ihep/thread_cpp11 4 | 5 | ## 已经实现的功能 6 | 7 | 1. corePoolSize个数的核心线程(核心线程不会退出),并根据任务量最大扩展到maxPoolSize个 8 | 2. 线程池线程数=corePoolSize+提交的线程数量(submit和execute),不会超过maxPoolSize 9 | 3. 可以设置线程数量 10 | 4. 可以判断线程池状态 11 | 6. 可以使用execute和submit提交任务(两种方式有差别) 12 | 7. 可以设置线程回收策略也可以手动回收非core线程 13 | 8. 线程回收策略使用的是thread.join(),可以避免线程资源无法释放 14 | 9. everPoolSize是线程池出现过的线程数 15 | 10. 每个线程有自己的工作队列 16 | 11. Thread类丰富了std::thread的功能,设置名称,id,检查是否存活,是否空闲等等 17 | 12. 任务窃取线程池 18 | 13. 定时调用线程池,任务队列采用vector形成小顶堆,时间最小排在前面 19 | 14. Thread类不需要手动释放(join或detach) 20 | 21 | ## 用法 22 | 1. 类似Java Executor 23 | 2. 例子:example文件夹下 24 | 3. 符合C++11标准 25 | 4. linux平台(可能会做跨平台) 26 | 27 | 5. Thread示例 28 | 29 | ```c 30 | std::promise promise; 31 | std::future future(promise.get_future()); 32 | 33 | Thread t([&promise]() { 34 | std::cout << "thread start.." << std::endl; 35 | promise.set_value(999); 36 | }); 37 | 38 | t.start(); 39 | //不需要手动释放线程资源 40 | //t.join(); 41 | 42 | std::cout << future.get() << std::endl; 43 | ``` 44 | 45 | 6. ScheduledThreadPoolExecutor示例 46 | 47 | ```c 48 | ScheduledThreadPoolExecutor tpe(3, "STPE"); 49 | tpe.preStartCoreThreads(); 50 | //在ScheduledThreadPoolExecutor中使用std::future 51 | std::packaged_task p([]() ->std::string { 52 | std::ostringstream os; 53 | std::time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); 54 | std::cout << "Task: " << std::asctime(std::localtime(&tt)); 55 | os << "Task schedule's the last time is " << std::asctime(std::localtime(&tt)); 56 | return os.str(); 57 | }); 58 | std::future f(p.get_future()); 59 | tpe.scheduleAtFixedRate([&]() { 60 | p(); 61 | p.reset();//每次执行后都要取消关联才能再次执行 62 | }, std::chrono::seconds(2), std::chrono::seconds(2)); 63 | ``` 64 | 65 | ## 缺陷 66 | 1. 线程使用的任务队列有锁 67 | 2. 所有线程对任务执行的包装是一个Runnable类,对象构造比较耗时,可以改为std::function 68 | 3. 定时调用队列使用了sleep,会使线程睡眠,之后唤醒,切换耗时较大,可以使用epoll 69 | 4. 不能限制任务数量(限流) 70 | 不建议在生产环境使用 71 | 72 | ## 参考 73 | 1. JDK1.8源码 74 | 2. C++并发编程实战 75 | 3. folly 76 | 77 | ## change log 78 | 79 | 1. 实现线程池动态可伸缩--未使用interruptible_thread,利用join()将线程释放后移出线程队列 80 | 2. 实现Thread类--不使用interruptible_thread,Thread类通过重写run()可以实现想要的操作 81 | 3. 完善了ThreadPoolExecutor,每个线程有自己的工作队列,可以批量添加任务 82 | 4. interruptible_thread功能可能会考虑以后添加 83 | 5. 实现WorkStealingThreadPool 84 | 6. 修改BlockingQueue为BlockingQueue,这样任务提交后仍然能够拿到结果 85 | 7. Runnable类的复制构造函数不会复制原来Runnable对象初始化的lambda 86 | 8. 实现ScheduledThreadPoolExecutor 87 | 88 | ## License 89 | 90 | Mozilla 91 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(thread_pool) 3 | 4 | add_definitions(-Wall -Wextra -std=c++11 -rdynamic) 5 | set(CMAKE_CXX_COMPILER "g++") 6 | set(CMAKE_C_COMPILER "gcc") 7 | set(CXX_FLAGS -g -Wall -Wextra -Wconversion -std=c++11 -rdynamic) 8 | #-Werror 9 | #-DVALGRIND 10 | #-DCHECK_PTHREAD_RETURN_VALUE 11 | #-D_FILE_OFFSET_BITS=64 12 | #-Wconversion 13 | #-Wno-unused-parameter 14 | #-Wold-style-cast 15 | #-Woverloaded-virtual 16 | #-Wpointer-arith 17 | #-Wshadow 18 | #-Wwrite-strings 19 | #-march=native 20 | #-MMD 21 | #) 22 | 23 | if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") 24 | list(APPEND CXX_FLAGS "-Wno-null-dereference") 25 | list(APPEND CXX_FLAGS "-Wno-sign-conversion") 26 | list(APPEND CXX_FLAGS "-Wno-unused-local-typedef") 27 | list(APPEND CXX_FLAGS "-Wthread-safety") 28 | list(REMOVE_ITEM CXX_FLAGS "-rdynamic") 29 | endif() 30 | 31 | aux_source_directory(src SRC) 32 | add_library(thread_pool SHARED ${SRC}) 33 | target_link_libraries(thread_pool pthread) 34 | target_include_directories(thread_pool PUBLIC include) 35 | 36 | add_executable(test01 ./example/test01.cpp) 37 | target_link_libraries(test01 thread_pool) 38 | add_executable(test02 ./example/test02.cpp) 39 | target_link_libraries(test02 thread_pool) 40 | add_executable(test03 ./example/test03.cpp) 41 | target_link_libraries(test03 thread_pool) 42 | add_executable(test04 ./example/test04.cpp) 43 | target_link_libraries(test04 thread_pool) 44 | add_executable(test05 ./example/test05.cpp) 45 | target_link_libraries(test05 thread_pool) 46 | add_executable(test06 ./example/test06.cpp) 47 | target_link_libraries(test06 thread_pool) 48 | target_include_directories(test06 PUBLIC include) 49 | add_executable(test07 ./example/test07.cpp) 50 | target_link_libraries(test07 thread_pool) 51 | target_include_directories(test07 PUBLIC include) 52 | add_executable(test08 ./example/test08.cpp) 53 | target_link_libraries(test08 thread_pool) 54 | target_include_directories(test08 PUBLIC include) 55 | add_executable(test09 ./example/test09.cpp) 56 | target_link_libraries(test09 thread_pool) 57 | target_include_directories(test09 PUBLIC include) 58 | add_executable(test10 ./example/test10.cpp) 59 | target_link_libraries(test10 thread_pool) 60 | target_include_directories(test10 PUBLIC include) 61 | add_executable(test11 ./example/test11.cpp) 62 | target_link_libraries(test11 thread_pool) 63 | target_include_directories(test11 PUBLIC include) 64 | 65 | add_executable(rwlock_test ./example/rwlock_test.cpp) 66 | target_link_libraries(rwlock_test thread_pool) 67 | target_include_directories(rwlock_test PUBLIC include) 68 | 69 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 70 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 71 | -------------------------------------------------------------------------------- /doc/latex/structRunnable_1_1functor__t.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structRunnable_1_1functor__t}{}\section{Runnable\+:\+:functor\+\_\+t$<$ F $>$ 模板结构体 参考} 2 | \label{structRunnable_1_1functor__t}\index{Runnable\+::functor\+\_\+t$<$ F $>$@{Runnable\+::functor\+\_\+t$<$ F $>$}} 3 | 4 | 5 | 类 Runnable\+:\+:functor\+\_\+t$<$ F $>$ 继承关系图\+:\nopagebreak 6 | \begin{figure}[H] 7 | \begin{center} 8 | \leavevmode 9 | \includegraphics[width=206pt]{structRunnable_1_1functor__t__inherit__graph} 10 | \end{center} 11 | \end{figure} 12 | 13 | 14 | Runnable\+:\+:functor\+\_\+t$<$ F $>$ 的协作图\+:\nopagebreak 15 | \begin{figure}[H] 16 | \begin{center} 17 | \leavevmode 18 | \includegraphics[width=206pt]{structRunnable_1_1functor__t__coll__graph} 19 | \end{center} 20 | \end{figure} 21 | \subsection*{Public 成员函数} 22 | \begin{DoxyCompactItemize} 23 | \item 24 | \hyperlink{structRunnable_1_1functor__t_a8125c5656f64c62ac856b0c4cbb2b1c6}{functor\+\_\+t} (F \&\&f) 25 | \begin{DoxyCompactList}\small\item\em \hyperlink{structRunnable_1_1functor__t}{functor\+\_\+t} 构造函数 \end{DoxyCompactList}\item 26 | \mbox{\Hypertarget{structRunnable_1_1functor__t_a404feeb85c1820746441eac72f511796}\label{structRunnable_1_1functor__t_a404feeb85c1820746441eac72f511796}} 27 | void \hyperlink{structRunnable_1_1functor__t_a404feeb85c1820746441eac72f511796}{call} () override 28 | \begin{DoxyCompactList}\small\item\em call 执行被包装的函数 \end{DoxyCompactList}\end{DoxyCompactItemize} 29 | \subsection*{Public 属性} 30 | \begin{DoxyCompactItemize} 31 | \item 32 | \mbox{\Hypertarget{structRunnable_1_1functor__t_ad0c111f247499208497940336bf4bf17}\label{structRunnable_1_1functor__t_ad0c111f247499208497940336bf4bf17}} 33 | F {\bfseries f\+\_\+} 34 | \end{DoxyCompactItemize} 35 | 36 | 37 | \subsection{构造及析构函数说明} 38 | \mbox{\Hypertarget{structRunnable_1_1functor__t_a8125c5656f64c62ac856b0c4cbb2b1c6}\label{structRunnable_1_1functor__t_a8125c5656f64c62ac856b0c4cbb2b1c6}} 39 | \index{Runnable\+::functor\+\_\+t@{Runnable\+::functor\+\_\+t}!functor\+\_\+t@{functor\+\_\+t}} 40 | \index{functor\+\_\+t@{functor\+\_\+t}!Runnable\+::functor\+\_\+t@{Runnable\+::functor\+\_\+t}} 41 | \subsubsection{\texorpdfstring{functor\+\_\+t()}{functor\_t()}} 42 | {\footnotesize\ttfamily template$<$typename F $>$ \\ 43 | \hyperlink{structRunnable_1_1functor__t}{Runnable\+::functor\+\_\+t}$<$ F $>$\+::\hyperlink{structRunnable_1_1functor__t}{functor\+\_\+t} (\begin{DoxyParamCaption}\item[{F \&\&}]{f }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}} 44 | 45 | 46 | 47 | \hyperlink{structRunnable_1_1functor__t}{functor\+\_\+t} 构造函数 48 | 49 | 50 | \begin{DoxyParams}{参数} 51 | {\em std\+::move(f)} & 包装的函数 \\ 52 | \hline 53 | \end{DoxyParams} 54 | 55 | 56 | 该结构体的文档由以下文件生成\+:\begin{DoxyCompactItemize} 57 | \item 58 | runnable.\+hpp\end{DoxyCompactItemize} 59 | -------------------------------------------------------------------------------- /include/runnable.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RUNNABLE_HPP 2 | #define RUNNABLE_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "functor_wrapper.hpp" 9 | 10 | /// @brief Runnable interface 重写operator()或传进lambda 11 | // 执行operator()可以运行任务 12 | // 千万不能把两个Runnable对象循环赋值 13 | class Runnable { 14 | public: 15 | /** 16 | * @brief std::shared_ptr别名 17 | */ 18 | using sptr = std::shared_ptr; 19 | 20 | template 21 | /** 22 | * @brief Runnable 构造函数 23 | * 24 | * @param f lambda 25 | */ 26 | Runnable(F&& f): functor_(new Functor_t(std::move(f))) {} 27 | 28 | /** 29 | * @brief Runnable 复制构造 30 | * 31 | * @param rh Runnable右值引用 32 | */ 33 | explicit Runnable(Runnable && rh): functor_(std::move(rh.functor_)) {} 34 | 35 | /** 36 | * @brief Runnable 拷贝构造不会复制functor_ 37 | * 38 | * @param rh Runnable引用 39 | */ 40 | explicit Runnable(Runnable & rh): functor_(std::move(rh.functor_)) {} 41 | 42 | /** 43 | * @brief operator= 复制 44 | * 45 | * @param rh 被复制的Runnable 46 | * 47 | * @return Runnable& 48 | */ 49 | Runnable& operator=(Runnable && rh) { 50 | functor_ = std::move(rh.functor_); 51 | return *this; 52 | } 53 | 54 | /** 55 | * @brief operator= 复制 56 | * 57 | * @param rh 被复制的Runnable 58 | * 59 | * @return Runnable& 60 | */ 61 | Runnable& operator=(Runnable & rh) { 62 | functor_ = std::move(rh.functor_); 63 | return *this; 64 | } 65 | 66 | /** 67 | * @brief Runnable 默认构造 68 | */ 69 | Runnable() = default; 70 | /** 71 | * @brief ~Runnable 析构函数 72 | */ 73 | virtual ~Runnable() = default; 74 | 75 | /** 76 | * @brief operator() 重载实现操作 77 | */ 78 | virtual void operator()() { 79 | if (functor_ != nullptr) { 80 | functor_->call(); 81 | } 82 | functor_.release(); 83 | } 84 | 85 | /** 86 | * @brief empty 判断内部的函数包装器是否为空 87 | * 88 | * @return bool true-空 89 | */ 90 | bool empty() const { 91 | return functor_ == nullptr; 92 | } 93 | 94 | protected: 95 | /** 96 | * @brief 函数包装器 97 | */ 98 | std::unique_ptr functor_; 99 | }; 100 | 101 | #endif /* RUNNABLE_HPP */ 102 | -------------------------------------------------------------------------------- /doc/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | CPP11ThreadPool: 首页 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
    19 |
    20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 |
    25 |
    CPP11ThreadPool 26 |
    27 |
    C++11线程池
    28 |
    32 |
    33 | 34 | 35 | 38 | 39 | 40 | 46 | 47 |
    48 | 49 |
    53 |
    54 | 55 | 56 |
    57 | 60 |
    61 | 62 |
    63 |
    64 |
    CPP11ThreadPool 文档
    65 |
    66 |
    67 |
    68 | 69 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /doc/html/functions_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | CPP11ThreadPool: 类成员 - 类型定义 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
    19 |
    20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 |
    25 |
    CPP11ThreadPool 26 |
    27 |
    C++11线程池
    28 |
    32 |
    33 | 34 | 35 | 38 | 39 | 40 | 46 | 47 |
    48 | 49 |
    53 |
    54 | 55 | 56 |
    57 | 60 |
    61 | 62 |
    63 |   69 |
    70 | 71 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /doc/html/menudata.js: -------------------------------------------------------------------------------- 1 | var menudata={children:[ 2 | {text:"首页",url:"index.html"}, 3 | {text:"类",url:"annotated.html",children:[ 4 | {text:"类列表",url:"annotated.html"}, 5 | {text:"类索引",url:"classes.html"}, 6 | {text:"类继承关系",url:"inherits.html"}, 7 | {text:"类成员",url:"functions.html",children:[ 8 | {text:"全部",url:"functions.html",children:[ 9 | {text:"a",url:"functions.html#index_a"}, 10 | {text:"b",url:"functions.html#index_b"}, 11 | {text:"c",url:"functions.html#index_c"}, 12 | {text:"d",url:"functions.html#index_d"}, 13 | {text:"e",url:"functions.html#index_e"}, 14 | {text:"f",url:"functions.html#index_f"}, 15 | {text:"g",url:"functions.html#index_g"}, 16 | {text:"i",url:"functions.html#index_i"}, 17 | {text:"j",url:"functions.html#index_j"}, 18 | {text:"k",url:"functions.html#index_k"}, 19 | {text:"l",url:"functions.html#index_l"}, 20 | {text:"m",url:"functions.html#index_m"}, 21 | {text:"n",url:"functions.html#index_n"}, 22 | {text:"o",url:"functions.html#index_o"}, 23 | {text:"p",url:"functions.html#index_p"}, 24 | {text:"r",url:"functions.html#index_r"}, 25 | {text:"s",url:"functions.html#index_s"}, 26 | {text:"t",url:"functions.html#index_t"}, 27 | {text:"w",url:"functions.html#index_w"}, 28 | {text:"y",url:"functions.html#index_y"}, 29 | {text:"~",url:"functions.html#index_0x7e"}]}, 30 | {text:"函数",url:"functions_func.html",children:[ 31 | {text:"a",url:"functions_func.html#index_a"}, 32 | {text:"b",url:"functions_func.html#index_b"}, 33 | {text:"c",url:"functions_func.html#index_c"}, 34 | {text:"d",url:"functions_func.html#index_d"}, 35 | {text:"e",url:"functions_func.html#index_e"}, 36 | {text:"f",url:"functions_func.html#index_f"}, 37 | {text:"g",url:"functions_func.html#index_g"}, 38 | {text:"i",url:"functions_func.html#index_i"}, 39 | {text:"j",url:"functions_func.html#index_j"}, 40 | {text:"k",url:"functions_func.html#index_k"}, 41 | {text:"o",url:"functions_func.html#index_o"}, 42 | {text:"p",url:"functions_func.html#index_p"}, 43 | {text:"r",url:"functions_func.html#index_r"}, 44 | {text:"s",url:"functions_func.html#index_s"}, 45 | {text:"t",url:"functions_func.html#index_t"}, 46 | {text:"w",url:"functions_func.html#index_w"}, 47 | {text:"y",url:"functions_func.html#index_y"}, 48 | {text:"~",url:"functions_func.html#index_0x7e"}]}, 49 | {text:"变量",url:"functions_vars.html",children:[ 50 | {text:"c",url:"functions_vars.html#index_c"}, 51 | {text:"e",url:"functions_vars.html#index_e"}, 52 | {text:"f",url:"functions_vars.html#index_f"}, 53 | {text:"i",url:"functions_vars.html#index_i"}, 54 | {text:"k",url:"functions_vars.html#index_k"}, 55 | {text:"l",url:"functions_vars.html#index_l"}, 56 | {text:"m",url:"functions_vars.html#index_m"}, 57 | {text:"n",url:"functions_vars.html#index_n"}, 58 | {text:"p",url:"functions_vars.html#index_p"}, 59 | {text:"r",url:"functions_vars.html#index_r"}, 60 | {text:"s",url:"functions_vars.html#index_s"}, 61 | {text:"t",url:"functions_vars.html#index_t"}, 62 | {text:"w",url:"functions_vars.html#index_w"}, 63 | {text:"y",url:"functions_vars.html#index_y"}]}, 64 | {text:"类型定义",url:"functions_type.html"}]}]}, 65 | {text:"文件",url:"files.html",children:[ 66 | {text:"文件列表",url:"files.html"}]}]} 67 | -------------------------------------------------------------------------------- /doc/html/search/all_11.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['take',['take',['../classBlockingQueue.html#aac788baea510940fc40961a285bacc5f',1,'BlockingQueue']]], 4 | ['terminated',['terminated',['../classThreadPoolExecutor.html#a61774315237123faf8e7fcc9d35ae47d',1,'ThreadPoolExecutor::terminated()'],['../classThreadPoolExecutor.html#a15bb29c714876435f3c59cd0137ac074',1,'ThreadPoolExecutor::TERMINATED()']]], 5 | ['thread',['Thread',['../classThread.html',1,'Thread'],['../classThread.html#a66350772ff3af06962db113658a72ae3',1,'Thread::Thread(int pro)'],['../classThread.html#a038819a1ef7bb4e50ae580d477f1a3b0',1,'Thread::Thread(const std::string &name="", int pro=20)'],['../classThread.html#a61efca5f0beb62628c515fb7cdef7e08',1,'Thread::Thread(FunctionType f, const std::string &name="", int pro=20)']]], 6 | ['thread_5f',['thread_',['../classThread.html#ad313ba812a7875c743dd0d37d565acfb',1,'Thread']]], 7 | ['threadpoolexecutor',['ThreadPoolExecutor',['../classThreadPoolExecutor.html',1,'ThreadPoolExecutor'],['../classThreadPoolExecutor.html#a212b34b7e25e9eba4e096473a1b81f9e',1,'ThreadPoolExecutor::ThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, const RejectedExecutionHandler &handler, const std::string &prefix="")'],['../classThreadPoolExecutor.html#ab750236e7b95489a1cb66d4b026717fc',1,'ThreadPoolExecutor::ThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::vector< BlockingQueue< Runnable::sptr >> &workQueue, RejectedExecutionHandler *handler, const std::string &prefix="")'],['../classThreadPoolExecutor.html#a071bcc9eb42b365e2ce28a32938d422e',1,'ThreadPoolExecutor::ThreadPoolExecutor(int32_t corePoolSize, int32_t maxPoolSize, const std::string &prefix="")']]], 8 | ['threads_5f',['threads_',['../classThreadPoolExecutor.html#a47dd74330fa41d01067943b1db74818a',1,'ThreadPoolExecutor']]], 9 | ['tidying',['TIDYING',['../classThreadPoolExecutor.html#a3d2a0964f6bce420433491da80000c4c',1,'ThreadPoolExecutor']]], 10 | ['timedwait',['timedWait',['../classSemaphore.html#a203e6b9f726ca5defc94379e9145278e',1,'Semaphore']]], 11 | ['timertask',['TimerTask',['../structTimerTask.html',1,'TimerTask'],['../structTimerTask.html#ab87d7c5c62a8a079031b39eea3958c65',1,'TimerTask::TimerTask(const std::chrono::nanoseconds &initDelay, const std::chrono::nanoseconds &interval, bool fixedRate, F &&f)'],['../structTimerTask.html#a1b24917388958b16efb2d4d42593e96e',1,'TimerTask::TimerTask(const TimerTask &rh)'],['../structTimerTask.html#a028f1f4221afe88383ac3c17b4c1ea41',1,'TimerTask::TimerTask()=default']]], 12 | ['tostring',['toString',['../classScheduledThreadPoolExecutor.html#a4a785e058d76dc861a23904d7e1033f0',1,'ScheduledThreadPoolExecutor::toString()'],['../classThreadPoolExecutor.html#a8e340cec3bb976f7773db103d73189c2',1,'ThreadPoolExecutor::toString()']]], 13 | ['try_5fpop',['try_pop',['../classBlockingQueue.html#a47a2d7726112b4e2d7b3f65a4e84aa06',1,'BlockingQueue']]], 14 | ['trywait',['tryWait',['../classSemaphore.html#acc15178e43d33745f4acc6e2b2cccf9b',1,'Semaphore']]] 15 | ]; 16 | -------------------------------------------------------------------------------- /doc/html/search/all_10.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['schedule',['schedule',['../classScheduledThreadPoolExecutor.html#a45e622833714db87a86d50eb45c8f338',1,'ScheduledThreadPoolExecutor::schedule(F f, const std::chrono::nanoseconds &delay)'],['../classScheduledThreadPoolExecutor.html#a30f723414e619a950f1efd968d13921d',1,'ScheduledThreadPoolExecutor::schedule(const std::shared_ptr< TimerTask > &f)']]], 4 | ['scheduleatfixeddelay',['scheduleAtFixedDelay',['../classScheduledThreadPoolExecutor.html#a594bb3111f9d051ad12f366a13a54db0',1,'ScheduledThreadPoolExecutor']]], 5 | ['scheduleatfixedrate',['scheduleAtFixedRate',['../classScheduledThreadPoolExecutor.html#aebcb96fcb3f5bfc6e55ffcef9f38d60b',1,'ScheduledThreadPoolExecutor']]], 6 | ['scheduledthreadpoolexecutor',['ScheduledThreadPoolExecutor',['../classScheduledThreadPoolExecutor.html',1,'ScheduledThreadPoolExecutor'],['../classScheduledThreadPoolExecutor.html#a880b17439bcdcf9b7542925e24033691',1,'ScheduledThreadPoolExecutor::ScheduledThreadPoolExecutor()']]], 7 | ['self',['self',['../classThread.html#a554185abbfacbcc4bf2e953cdddcbbba',1,'Thread']]], 8 | ['semaphore',['Semaphore',['../classSemaphore.html',1,'Semaphore'],['../classSemaphore.html#a34841feb22e781d7d10ee7205f56bd8e',1,'Semaphore::Semaphore()']]], 9 | ['setmaxpoolsize',['setMaxPoolSize',['../classThreadPoolExecutor.html#ac5a10d336958ca43530b31bff81c9c4b',1,'ThreadPoolExecutor']]], 10 | ['setname',['setName',['../classThread.html#ae816904b2a3e248472813e17c2b12a71',1,'Thread']]], 11 | ['setprio',['setPrio',['../classThread.html#a96661f80f5fbd26042a24eafd675cd91',1,'Thread']]], 12 | ['setrejectedexecutionhandler',['setRejectedExecutionHandler',['../classThreadPoolExecutor.html#a0a471dc0a68b70d99d8215565a4df688',1,'ThreadPoolExecutor']]], 13 | ['shutdown',['shutdown',['../classThreadPoolExecutor.html#aaa834c4350d6b12826803bb13dd467ea',1,'ThreadPoolExecutor::shutdown() final'],['../classThreadPoolExecutor.html#aa0958f2bf040bf2f199c629ec9145b44',1,'ThreadPoolExecutor::SHUTDOWN()']]], 14 | ['size',['size',['../classBlockingQueue.html#a733361d5721c6ba64af3e129921c43b0',1,'BlockingQueue']]], 15 | ['sptr',['sptr',['../classRunnable.html#abe8d3066c7305401d6f0aad8e70780f2',1,'Runnable::sptr()'],['../classThread.html#a430059e402325caaf1ed185fb520c9d2',1,'Thread::sptr()']]], 16 | ['start',['start',['../classThread.html#a3a36451e02a15180624cdd88212cb1ba',1,'Thread']]], 17 | ['stdid',['stdId',['../classThread.html#a231da16ab1825ee982c4aa43f78c1b22',1,'Thread']]], 18 | ['stop',['STOP',['../classThreadPoolExecutor.html#ae3c0ff657b3c0d8bbaf7f10bfdf587ca',1,'ThreadPoolExecutor::STOP()'],['../classThreadPoolExecutor.html#a588ec33baf402afd0e1c52b11d9234da',1,'ThreadPoolExecutor::stop() final']]], 19 | ['stop_5f',['stop_',['../classThread.html#a091bdad0a084b3f2c659f8cdd5369d53',1,'Thread']]], 20 | ['submit',['submit',['../classThreadPoolExecutor.html#a94834ab6bedcc75111524fec4e928b3f',1,'ThreadPoolExecutor::submit()'],['../classWorkStealingThreadPoolExecutor.html#a7fa1b79c8be2b06a7952ccfd14aa7f6c',1,'WorkStealingThreadPoolExecutor::submit()']]], 21 | ['submitid_5f',['submitId_',['../classThreadPoolExecutor.html#a32da434f74911bcc1702eaafabfac368',1,'ThreadPoolExecutor']]] 22 | ]; 23 | --------------------------------------------------------------------------------