Move 3rd party libraries to "vendored" directory

This commit is contained in:
Antonio SJ Musumeci 2026-02-28 12:53:29 -06:00
parent b5b9ea2083
commit c04ad45093
434 changed files with 17 additions and 14 deletions

View file

@ -1,65 +0,0 @@
#include "maintenance_thread.hpp"
#include "mutex.hpp"
#include "fmt/core.h"
#include <cassert>
#include <vector>
#include <pthread.h>
#include <unistd.h>
static pthread_t g_thread;
static std::vector<std::function<void(int)>> g_funcs;
static mutex_t g_mutex;
static
void*
_thread_loop(void *)
{
int count;
pthread_setname_np(pthread_self(),"fuse.maint");
count = 0;
while(true)
{
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,NULL);
{
LockGuard lg(g_mutex);
for(auto &func : g_funcs)
func(count);
}
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
count++;
::sleep(60);
}
return NULL;
}
void
MaintenanceThread::setup()
{
int rv;
rv = pthread_create(&g_thread,NULL,_thread_loop,NULL);
assert((rv == 0) && "pthread_create failed");
}
void
MaintenanceThread::push_job(const std::function<void(int)> &func_)
{
LockGuard lg(g_mutex);
g_funcs.emplace_back(func_);
}
void
MaintenanceThread::stop()
{
pthread_cancel(g_thread);
pthread_join(g_thread,NULL);
}