mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 06:00:08 +01:00
Separate cpu detection and printing logic
This commit is contained in:
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user