tried to implement a thread pool, but seems to easily deadlock

everything seems solid and responsive in master, but spamming messages can exhaust threads. so I tried to implement a thread pool. but it sucks, because this version hangs the clients something bad. not sure why, but please don't merge! just look and perhaps try to figure it out if you need the thread pool.

I won't be active much tomorrow. good luck team!