Separate cpu detection and printing logic

This commit is contained in:
Linus Dierheimer
2022-09-04 22:20:12 +02:00
parent a4e0275263
commit ea60fd0a0d
14 changed files with 246 additions and 235 deletions
+4 -18
View File
@@ -1,25 +1,11 @@
#include "host.h"
#include "pthread.h"
#include "detection/internal.h"
void ffDetectHostImpl(FFHostResult* host);
const FFHostResult* ffDetectHost()
{
static FFHostResult host;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static bool init = false;
pthread_mutex_lock(&mutex);
if(init)
{
pthread_mutex_unlock(&mutex);
return &host;
}
init = true;
ffDetectHostImpl(&host);
pthread_mutex_unlock(&mutex);
return &host;
FF_DETECTION_INTERNAL_GUARD(FFHostResult,
ffDetectHostImpl(&result)
);
}
+2 -2
View File
@@ -1,7 +1,7 @@
#pragma once
#ifndef FF_INCLUDED_DETECTION_HOST_host
#define FF_INCLUDED_DETECTION_HOST_host
#ifndef FF_INCLUDED_detection_host_host
#define FF_INCLUDED_detection_host_host
#include "fastfetch.h"