feat/support_fiber #2
@ -105,9 +105,9 @@ TILE_INSTANCE_CHRONO_FORMAT_AS(std::chrono::years, "y")
|
||||
#include "fmt/format.h"
|
||||
#include "fmt/ostream.h"
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &os, std::nullptr_t) {
|
||||
return os << "nullptr";
|
||||
}
|
||||
// inline std::ostream &operator<<(std::ostream &os, std::nullptr_t) {
|
||||
// return os << "nullptr";
|
||||
// }
|
||||
|
||||
// template <typename T,
|
||||
// typename = tile::enable_if_t<
|
||||
|
@ -46,8 +46,8 @@ struct alignas(hardware_destructive_interference_size) Fiber::FiberContext {
|
||||
|
||||
void FiberEntry(fcontext_transfer_t t) {
|
||||
std::function<void()> *fn = static_cast<std::function<void()> *>(t.data);
|
||||
TILE_CHECK_NE(t.data, nullptr);
|
||||
TILE_CHECK_NE(t.fctx, nullptr);
|
||||
TILE_CHECK(t.data != nullptr);
|
||||
TILE_CHECK(t.fctx != nullptr);
|
||||
Fiber *self = nullptr;
|
||||
|
||||
try {
|
||||
@ -84,7 +84,7 @@ fcontext_t CreateFiber(void *stack, std::size_t stack_size,
|
||||
std::function<void()> *fn) {
|
||||
void *stack_top = static_cast<char *>(stack) + stack_size;
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user