diff --git a/LICENSE b/LICENSE index 10a83dc63c2a53a3ce2895ef38abaa4ee277d361..f41019593de3b49419418d87292483588c975eff 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -Academic Free License (“AFL”) v. 3.0 +Eterfree License (“EL”) v. 1.0 -This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: +This Eterfree License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: Licensed under the Academic Free License version 3.0 @@ -8,7 +8,7 @@ Licensed under the Academic Free License version 3.0 a) to reproduce the Original Work in copies, either alone or as part of a collective work; b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; - c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor’s reserved rights and remedies, in this Academic Free License; + c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor’s reserved rights and remedies, in this Eterfree License; d) to perform the Original Work publicly; and e) to display the Original Work publicly. @@ -40,4 +40,4 @@ Licensed under the Academic Free License version 3.0 15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. -16) Modification of This License. This License is Copyright © 2017 CDU Innovation Studio. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under Academic Free License" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. +16) Modification of This License. This License is Copyright © 2017 CDU Innovation Studio. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Eterfree License" or "EL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under Eterfree License" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/src/ThreadPool.cpp b/src/ThreadPool.cpp index 3025a1a56f743e52dd4b2bad4e69fbb77c61f544..bcf336c4734a12dd70a615507c680a3222d5f77f 100644 --- a/src/ThreadPool.cpp +++ b/src/ThreadPool.cpp @@ -526,7 +526,7 @@ void ThreadPool::clearTask() } // 获取代理 -ThreadPool::Proxy ThreadPool::getProxy() +ThreadPool::Proxy ThreadPool::getProxy() const { return load(); } diff --git a/src/ThreadPool.h b/src/ThreadPool.h index 27be235b5fe6b5a680e5d056a40b8973a2483592..32c6865e38e320a04a5c40214a1a81ea4df96616 100644 --- a/src/ThreadPool.h +++ b/src/ThreadPool.h @@ -3,7 +3,7 @@ * 语言标准:C++17 * * 创建日期:2017年09月22日 -* 更新日期:2023年01月20日 +* 更新日期:2023年01月23日 * * 摘要 * 1.线程池类ThreadPool定义于此文件,实现于ThreadPool.cpp。 @@ -228,7 +228,7 @@ public: void clearTask(); // 获取代理 - Proxy getProxy(); + Proxy getProxy() const; }; class ThreadPool::Proxy diff --git a/test/test1.cpp b/test/test1.cpp index 899a7b081a2cbfbfc5b37cceb5f0991dca1584fb..6605100d29e6d62739761b9f4bfde36d3ef4dbc3 100644 --- a/test/test1.cpp +++ b/test/test1.cpp @@ -51,7 +51,7 @@ static void execute(ThreadPool& _threadPool) static void terminate(ThreadPool&& _threadPool) { _threadPool.clearTask(); - auto threadPool(std::forward(_threadPool)); + auto threadPool(std::forward(_threadPool)); (void)threadPool; } @@ -76,7 +76,7 @@ static void execute(ThreadPool& _threadPool) static void terminate(ThreadPool&& _threadPool) { - auto threadPool(std::forward(_threadPool)); + auto threadPool(std::forward(_threadPool)); (void)threadPool; } #endif diff --git a/test/test2.cpp b/test/test2.cpp index e339388cc0b5b64cb70c7b33725301c2ed88470d..b3e3896de15de5ff2eda51f555a9f93021346edd 100644 --- a/test/test2.cpp +++ b/test/test2.cpp @@ -20,10 +20,11 @@ static void task() static void print(const ThreadPool& _threadPool) { - std::cout << _threadPool.getCapacity() << ' ' \ - << _threadPool.getTotalSize() << ' ' \ - << _threadPool.getIdleSize() << ' ' \ - << _threadPool.getTaskSize() << std::endl; + auto proxy = _threadPool.getProxy(); + std::cout << proxy.getCapacity() << ' ' \ + << proxy.getTotalSize() << ' ' \ + << proxy.getIdleSize() << ' ' \ + << proxy.getTaskSize() << std::endl; } int main() diff --git a/test/test3.cpp b/test/test3.cpp index e6285b6e6ad0fd3ac7b8e25a6d2db7864a22ed03..2ebe22ba3aabe20cf4864167bf3343306a9b120a 100644 --- a/test/test3.cpp +++ b/test/test3.cpp @@ -10,14 +10,16 @@ int main() eterfree::Thread thread; cout << thread.getID() << endl; - thread.configure([] { cout << "Eterfree" << endl; }, nullptr); + thread.configure([] \ + { cout << "Eterfree" << endl; }, nullptr); cout << boolalpha << thread.notify() << endl; thread.destroy(); thread.create(); cout << thread.getID() << endl; - thread.configure([] { cout << "solifree" << endl; }, nullptr); + thread.configure([] \ + { cout << "solifree" << endl; }, nullptr); cout << boolalpha << thread.notify() << endl; return EXIT_SUCCESS; }