C++11 threading plus vincent's AsyncCore rewrite

This is a merge of PR's #399, #402, #408, plus fixes to make them play nicely together.