feat add futures

This commit is contained in:
tqcq
2024-03-14 17:55:44 +08:00
parent f8d2b051ee
commit 15bdc54bef
10 changed files with 535 additions and 9 deletions

View File

@@ -0,0 +1,10 @@
#include <gtest/gtest.h>
#include <sled/futures/future.h>
#include <sled/futures/promise.h>
TEST(Future, Test1)
{
sled::Promise<int> promise;
sled::Future<int> future = promise.GetFuture();
promise.SetValue(42);
}

10
src/system/pid.cc Normal file
View File

@@ -0,0 +1,10 @@
#include "sled/system/pid.h"
namespace sled {
pid_t
GetCachedPID()
{
static pid_t cached_pid = getpid();
return cached_pid;
}
}// namespace sled