提交 cea8ad50 编写于 作者: 独孤过's avatar 独孤过

update v2.2.0

上级 af18d45d
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.
......@@ -526,7 +526,7 @@ void ThreadPool::clearTask()
}
// 获取代理
ThreadPool::Proxy ThreadPool::getProxy()
ThreadPool::Proxy ThreadPool::getProxy() const
{
return load();
}
......
......@@ -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
......
......@@ -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>(_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>(_threadPool));
(void)threadPool;
}
#endif
......
......@@ -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()
......
......@@ -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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册