feat/support_fiber #2

Merged
tqcq merged 57 commits from feat/support_fiber into master 2024-06-21 10:33:52 +08:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 56a12ea2e2 - Show all commits

View File

@ -105,9 +105,9 @@ TILE_INSTANCE_CHRONO_FORMAT_AS(std::chrono::years, "y")
#include "fmt/format.h" #include "fmt/format.h"
#include "fmt/ostream.h" #include "fmt/ostream.h"
inline std::ostream &operator<<(std::ostream &os, std::nullptr_t) { // inline std::ostream &operator<<(std::ostream &os, std::nullptr_t) {
return os << "nullptr"; // return os << "nullptr";
} // }
// template <typename T, // template <typename T,
// typename = tile::enable_if_t< // typename = tile::enable_if_t<

View File

@ -46,8 +46,8 @@ struct alignas(hardware_destructive_interference_size) Fiber::FiberContext {
void FiberEntry(fcontext_transfer_t t) { void FiberEntry(fcontext_transfer_t t) {
std::function<void()> *fn = static_cast<std::function<void()> *>(t.data); std::function<void()> *fn = static_cast<std::function<void()> *>(t.data);
TILE_CHECK_NE(t.data, nullptr); TILE_CHECK(t.data != nullptr);
TILE_CHECK_NE(t.fctx, nullptr); TILE_CHECK(t.fctx != nullptr);
Fiber *self = nullptr; Fiber *self = nullptr;
try { try {
@ -84,7 +84,7 @@ fcontext_t CreateFiber(void *stack, std::size_t stack_size,
std::function<void()> *fn) { std::function<void()> *fn) {
void *stack_top = static_cast<char *>(stack) + stack_size; void *stack_top = static_cast<char *>(stack) + stack_size;
const fcontext_t fctx = make_fcontext(stack_top, stack_size, FiberEntry); const fcontext_t fctx = make_fcontext(stack_top, stack_size, FiberEntry);
TILE_CHECK_NE(fctx, nullptr); TILE_CHECK(fctx != nullptr);
return jump_fcontext(fctx, fn).fctx; return jump_fcontext(fctx, fn).fctx;
} }