[gcc-4.7 support] refactored ThreadPool, fixed DB;