acl/lib_fiber/cpp/include/fiber/fiber.hpp

52 lines
907 B
C++
Raw Normal View History

2016-06-24 10:39:05 +08:00
#pragma once
struct FIBER;
namespace acl {
/**
*
*/
class fiber
{
public:
fiber(void);
virtual ~fiber(void);
/**
*
* @param stack_size {size_t}
*/
void start(size_t stack_size = 64000);
/**
* ID
* @return {int}
*/
int get_id(void) const;
/**
* ID
*/
static int self(void);
/**
*
*/
static void schedule();
protected:
/**
* start
*
*/
virtual void run(void) = 0;
private:
FIBER *f_;
static void fiber_callback(FIBER *f, void *ctx);
};
} // namespace acl