Skip to content

Commit 51737c3

Browse files
committed
added comments & license in source
Storing the license in source files too is safer.
1 parent bb393fe commit 51737c3

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

ThreadPool.hpp

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,45 @@
1+
/*
2+
Copyright (c) 2012 Jakob Progsch, Václav Zeman
3+
4+
This software is provided 'as-is', without any express or implied
5+
warranty. In no event will the authors be held liable for any damages
6+
arising from the use of this software.
7+
8+
Permission is granted to anyone to use this software for any purpose,
9+
including commercial applications, and to alter it and redistribute it
10+
freely, subject to the following restrictions:
11+
12+
1. The origin of this software must not be misrepresented; you must not
13+
claim that you wrote the original software. If you use this software
14+
in a product, an acknowledgment in the product documentation would be
15+
appreciated but is not required.
16+
17+
2. Altered source versions must be plainly marked as such, and must not be
18+
misrepresented as being the original software.
19+
20+
3. This notice may not be removed or altered from any source
21+
distribution.
22+
*/
23+
124
#ifndef THREAD_POOL_HPP
225
#define THREAD_POOL_HPP
326

27+
// containers
428
#include <vector>
529
#include <queue>
6-
#include <memory>
30+
// threading
731
#include <thread>
832
#include <mutex>
933
#include <condition_variable>
1034
#include <atomic>
1135
#include <future>
36+
// utility wrappers
37+
#include <memory>
1238
#include <functional>
39+
// exceptions
1340
#include <stdexcept>
1441

42+
// std::thread pool for resources recycling
1543
class ThreadPool {
1644
public:
1745
// the constructor just launches some amount of workers
@@ -44,6 +72,7 @@ class ThreadPool {
4472
}
4573
);
4674
}
75+
// deleted copy&move ctors&assignments
4776
ThreadPool(const ThreadPool&) = delete;
4877
ThreadPool& operator=(const ThreadPool&) = delete;
4978
ThreadPool(ThreadPool&&) = delete;
@@ -82,7 +111,8 @@ class ThreadPool {
82111
// synchronization
83112
std::mutex queue_mutex;
84113
std::condition_variable condition;
114+
// workers finalization flag
85115
std::atomic_bool stop;
86116
};
87117

88-
#endif
118+
#endif // THREAD_POOL_HPP

0 commit comments

Comments
 (0)