logging: support building with gcc-4.9
[folly.git] / folly / ThreadName.h
index d78e2fa17a5430e52ca67664dcb3b676210aef2d..ba7bde25953925e451fdc447af422643365edacd 100644 (file)
 #include <folly/portability/PThread.h>
 
 namespace folly {
+
 /**
  * This returns true if the current platform supports setting the name of the
  * current thread.
  */
 bool canSetCurrentThreadName();
+
 /**
  * This returns true if the current platform supports setting the name of
  * threads other than the one currently executing.
  */
 bool canSetOtherThreadName();
+
+/**
+ * Get the name of the given thread, or nothing if an error occurs
+ * or the functionality is not available.
+ */
+Optional<std::string> getThreadName(std::thread::id tid);
+
 /**
- * Get the name of the current string, or nothing if an error occurs.
+ * Equivalent to getThreadName(std::this_thread::get_id());
  */
 Optional<std::string> getCurrentThreadName();
 
+/**
+ * Set the name of the given thread.
+ * Returns false on failure, if an error occurs or the functionality
+ * is not available.
+ */
 bool setThreadName(std::thread::id tid, StringPiece name);
 #if FOLLY_HAVE_PTHREAD
 bool setThreadName(pthread_t pid, StringPiece name);
 #endif
+
+/**
+ * Equivalent to setThreadName(std::this_thread::get_id(), name);
+ */
 bool setThreadName(StringPiece name);
 }