1 #ifndef LIBCOMMUNISM_COTHREAD_H
2 #define LIBCOMMUNISM_COTHREAD_H
27 using Entry = std::function<void()>;
149 this->label = newLabel;
185 std::string label{
""};
188 CothreadImpl *impl{
nullptr};
190 static thread_local
Cothread *gCurrent;
199 std::array<uintptr_t, 32> implBuffer;
201 bool implBufferUsed{
false};
Instance of a single cooperative thread.
static void SetReturnHandler(const std::function< void(Cothread *)> &handler)
Cothread(const Entry &entry, const size_t stackSize=0)
std::function< void()> Entry
Type alias for an entry point of a cothread.
static Cothread * Current()
size_t getStackSize() const
constexpr auto & getLabel() const
void setLabel(const std::string &newLabel)
static void ResetReturnHandler()
Main namespace for the libcommunism library.
Abstract interface for a platform implementation of cothreads.