Motivation:
Our API documentation claims that NIOThreadPool.start() will tolerate
being called multiple times. However, this wasn't actually true: in
debug mode it'd hit an assertion, and in release mode it would quietly
orphan all its threads and replace them with new ones, leaving there
with twice as many threads and some that wouldn't be closed down.
We should support the functionality we claim we do.
Modifications:
- Fixed the incorrect check for running thread pool state.
- Added a test to validate we actually allow multiple starts.
Result:
Thread pools really can be started multiple times.
Motivation:
Previously, NIOThreadPool would use super long thread names. Linux
doesn't allow more than 15 bytes (+ \0 char) so in the end they would
never get set at all.
Modifications:
- Shorten NIOThreadPool's thread names
- Only take the first 15 characters of thread names in general on Linux
Result:
We don't lose thread names on Linux.
Motivation:
NIOThreadPool was grossly abusing Dispatch to block a large number of
threads for (usually) blocking IO work.
Modifications:
Back the NIOThreadPool by NIOThreads (pthreads) instead of
DispatchQueues.
Result:
Less abuse.
Motivation:
The thread pool implementation can be used for many things not just
blocking IO.
Modifications:
rename BlockingIOThreadPool to NIOThreadPool
Result:
fixes#186