S版本 HAL层 子线程使用

2022-05-07  本文已影响0人  Ed_Lannister

.h头文件函数声明

  void dump_frame_thread();
  std::thread mDumpFrameThread;

cpp 头文件引用

#include <pthread.h>

函数主体

void HWCDisplayBuiltIn::dump_frame_thread(){
  pthread_setname_np(pthread_self(), "dump_frame_thread");
  ALOGE("ELHWC dump_frame_thread xxxxxxxxxxxxxxxxxxxxxxxxxxxxx run %s,LINE=%d ", __FUNCTION__,__LINE__);
}

调用子线程

HWC2::Error HWCDisplayBuiltIn::SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type,
                                                  int32_t format, bool post_processed) {
long timestart = getNowTime();
ALOGE("ELHWC %s mDumpFrameThread , while count =%d, bit_mask_layertype=%d, HAL_PIXEL_FORMAT_RGB_888 format =%d, post_processed=true,LINE=%d",
                   __FUNCTION__,count, bit_mask_layer_type, format,__LINE__);

mDumpFrameThread = std::thread(&HWCDisplayBuiltIn::dump_frame_thread, this);

if(mDumpFrameThread.joinable()){
    ALOGE("ELHWC detach mDumpFrameThread %s,LINE=%d", __FUNCTION__,__LINE__);
    mDumpFrameThread.detach();
}
上一篇下一篇

猜你喜欢

热点阅读