feat/support_fiber #2
@ -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<
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user