我是靠谱客的博主 等待大米,这篇文章主要介绍用static保证访问的是同一个mutex,现在分享给大家,希望可以做个参考。

static gpointer
smart_record_callback (NvDsSRRecordingInfo *info, gpointer userData)
{
  static GMutex mutex;
  FILE *logfile = NULL;
  g_return_val_if_fail (info, NULL);

  g_mutex_lock (&mutex);
  logfile = fopen ("smart_record.log", "a");
  if (logfile) {
    fprintf (logfile, "%d:%d:%d:%ldms:%s:%sn",
      info->sessionId, info->width, info->height, info->duration,
      info->dirpath, info->filename);
    fclose (logfile);
  } else {
    g_print ("Error in opeing smart record log filen");
  }
  g_mutex_unlock (&mutex);

  return NULL;
}

最后

以上就是等待大米最近收集整理的关于用static保证访问的是同一个mutex的全部内容,更多相关用static保证访问内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(166)

评论列表共有 0 条评论

立即
投稿
返回
顶部