Support for per-thread setup/teardown callbacks.

It is sometimes necessary to initialize some per-thread data or systems,
e.g. thread-local storage or `CoInitializeEx` for COM on Windows, or
even opening a single database connection per-thread.

This commit adds support for two new callbacks: `thread_setup` and
`thread_teardown` that, if not NULL, are called at the very beginning
and the very end of all threads created by Mongoose. Each of these
callbacks takes a single integer parameter that is 0 for the master
thread and 1 for the worker threads.

The implementation is minimal and as non-intrusive as possible.