hook mi_force_{un,}lock on OSX instead of pthread_atfork

This is patch by Anton Samokhvalov.

Apparently it helps with locking around forking on OSX.
diff --git a/src/libc_override_osx.h b/src/libc_override_osx.h
index 26923e9..b801f22 100644
--- a/src/libc_override_osx.h
+++ b/src/libc_override_osx.h
@@ -85,6 +85,11 @@
 #include <AvailabilityMacros.h>
 #include <malloc/malloc.h>
 
+namespace tcmalloc {
+  void CentralCacheLockAll();
+  void CentralCacheUnlockAll();
+}
+
 // from AvailabilityMacros.h
 #if defined(MAC_OS_X_VERSION_10_6) && \
     MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@@ -169,11 +174,11 @@
 }
 
 void mi_force_lock(malloc_zone_t *zone) {
-  // Hopefully unneeded by us!
+  tcmalloc::CentralCacheLockAll();
 }
 
 void mi_force_unlock(malloc_zone_t *zone) {
-  // Hopefully unneeded by us!
+  tcmalloc::CentralCacheUnlockAll();
 }
 
 void mi_statistics(malloc_zone_t *zone, malloc_statistics_t *stats) {
diff --git a/src/static_vars.cc b/src/static_vars.cc
index 197b3a1..09d2b59 100644
--- a/src/static_vars.cc
+++ b/src/static_vars.cc
@@ -51,7 +51,6 @@
 // sure the central_cache locks remain in a consisten state in the forked
 // version of the thread.
 
-static
 void CentralCacheLockAll()
 {
   Static::pageheap_lock()->Lock();
@@ -59,7 +58,6 @@
     Static::central_cache()[i].Lock();
 }
 
-static
 void CentralCacheUnlockAll()
 {
   for (int i = 0; i < kNumClasses; ++i)
@@ -114,9 +112,11 @@
 static inline
 void SetupAtForkLocksHandler()
 {
+#if !defined(__APPLE__)
   pthread_atfork(CentralCacheLockAll,    // parent calls before fork
                  CentralCacheUnlockAll,  // parent calls after fork
                  CentralCacheUnlockAll); // child calls after fork
+#endif
 }
 REGISTER_MODULE_INITIALIZER(tcmalloc_fork_handler, SetupAtForkLocksHandler());