On Wed, 22 Jul 2015 07:09:38 GMT, Taylor Gronka wrote:

For clarity, every variable I define globally in vibe.d is the same as thread-safe, correct? Basically, in regards to vibe.d, terms can mostly be used interchangeably? (With the exception of initializing with __gshared.)

I'm not sure if I said that right. I suppose, for a variable to be global, it must be full of static and const anyways. So, for a variable to be properly global, it must also be thread-safe (although I'm sure there are exceptions/mistakes that can be made). The two goals align.

static is a TLS specifier (thread-local storage), so you have a different instance there on Thread 1, Thread 2...

This means you don't need it to be thread-safe.

Connection pool should be specified as non-thread-safe, you have to wrap it in a TaskMutex if you make it shared : __gshared ConnectionPool!Object gs_objPool;

Otherwise, you'll have a single pool per thread, which is also fine.

Personally, I don't like listening on multiple threads, makes things more complicated. I would suggest you send "jobs" to worker tasks instead, using vibe.core.concurrency, and let the main thread deal with request/response.