Advertisement

Linux多线程C++工具库(liblmp_tool) CurrentThread类

阅读量:

该类的主要功能是获取当前线程的 tid 并在其体内存储,在后续操作中进行 ThreadPool 查询时,则只需进行一次简单的判断即可完成任务,并无需每次都重新获取 tid 值

Linux多线程编程工具库LMTP Tool开源项目:其GitHub仓库地址为https://github.com/Dwyane05/liblmp_tool

头文件实现:

  • The use of this source code is regulated by a BSD-style license, which can be located within the License file.
  • CurrentThread.h
  • Generated on May 30th, 2019.
  • Written by Cui Yongfei

#ifndef LMP_TOOL_CURRENTTHREAD_H
#define LMP_TOOL_CURRENTTHREAD_H

#include "Common.h"

namespace lmp_tool
{
namespace CurrentThread
{
// internal
extern __multithreaded static int t_cachedTid = 0;
extern __thread static ch

全部评论 (0)

还没有任何评论哟~