progschj / ThreadPool

A simple C++11 Thread Pool implementation
zlib License
7.85k stars 2.24k forks source link

Exit policy of pool is now configurable #21

Closed Link512 closed 9 years ago

Link512 commented 9 years ago

When the pool must exit, the option of draining the task queue or not is configurable. Updated readme and example to reflect this.

progschj commented 9 years ago

Funnily the first version of this did not drain the queue and I got a lot of mails etc. about the "wrong behavior". Since the main idea behind this repository is to provide some minimal version of a thread pool I won't merge this change. I like the idea of having features like this in forks.

Also if one really wanted this kind of behavior with this version one could give the tasks themselves some "atomic terminated;" they check before running and if it is true just return. This is maybe not terribly elegant but also avoids the issue of "leaked futures".

Link512 commented 9 years ago

Fair enough, glad I could contribute anyway to this.