fix more unused variable warnings
Compile time improvements
Removing dead code
Fixing serialize_buffer:

The serialize_buffer object goes out of scope before calling the deleter.
Reverting wrong "fix"
Making shutdown problems occur less frequently
Fixing linker error
Cosmetics
Cleaning up shutdown barrier
Fixing data race introduced by latest changes
Fixing PVS warnings
unlocking mutex while waiting
Fixing shutdown hang in debugger (Windows)
Fixing bad #include
Fixing incomplete type error in example
Fixing compilation problems related to atomic
More fixes for atomic
More incomplete type error fixes
More compilation problems related to atomic
Fixed #1069: serialize_buffer with allocator fails at destruction. Adding test.