threadnames.h raw

   1  // Copyright (c) 2018-present The Bitcoin Core developers
   2  // Distributed under the MIT software license, see the accompanying
   3  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
   4  
   5  #ifndef BITCOIN_UTIL_THREADNAMES_H
   6  #define BITCOIN_UTIL_THREADNAMES_H
   7  
   8  #include <string>
   9  
  10  namespace util {
  11  //! Rename a thread both in terms of an internal (in-memory) name as well
  12  //! as its system thread name.
  13  //! @note Do not call this for the main thread, as this will interfere with
  14  //! UNIX utilities such as top and killall. Use ThreadSetInternalName instead.
  15  void ThreadRename(const std::string&);
  16  
  17  //! Set the internal (in-memory) name of the current thread only.
  18  void ThreadSetInternalName(const std::string&);
  19  
  20  //! Get the thread's internal (in-memory) name; used e.g. for identification in
  21  //! logging.
  22  std::string ThreadGetInternalName();
  23  
  24  } // namespace util
  25  
  26  #endif // BITCOIN_UTIL_THREADNAMES_H
  27