[C++] Re-invent C++11-ish thread library

Android's build system uses -static to build ckati, and you
cannot use C++11's threading library with -static.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52590
diff --git a/stats.cc b/stats.cc
index e1e7992..9d4a160 100644
--- a/stats.cc
+++ b/stats.cc
@@ -16,11 +16,11 @@
 
 #include "stats.h"
 
-#include <mutex>
 #include <vector>
 
 #include "flags.h"
 #include "log.h"
+#include "mutex.h"
 #include "stringprintf.h"
 #include "thread_local.h"
 #include "timeutil.h"