30 fiber(
bool running =
false);
39 void start(
size_t stack_size = 320000);
51 bool killed(
void)
const;
60 static bool self_killed(
void);
66 unsigned int get_id(
void)
const;
72 static unsigned int self(void);
78 int get_errno(
void)
const;
84 void set_errno(
int errnum);
105 static const char* strerror(
int errnum,
char* buf,
size_t size);
111 static void stdout_open(
bool on);
123 static void init(
fiber_event_t type,
bool schedule_auto =
false);
128 static void schedule(
void);
141 static bool scheduled(
void);
146 static void schedule_stop(
void);
152 static void yield(
void);
157 static void switch_to_next(
void);
163 static void ready(
fiber& f);
170 static unsigned int delay(
unsigned int milliseconds);
176 static unsigned alive_number(
void);
182 static unsigned dead_number(
void);
189 static void hook_api(
bool on);
195 static void acl_io_hook(
void);
200 static void acl_io_unlock(
void);
206 static bool winapi_hook(
void);
212 static int get_sys_errno(
void);
218 static void set_sys_errno(
int errnum);
233 static void fiber_create(
void (*fn)(
ACL_FIBER*,
void*),
234 void* ctx,
size_t size);
241 virtual void run(
void);
247 void operator = (
const fiber&);
249 static void fiber_callback(
ACL_FIBER* f,
void* ctx);
266 void start(
unsigned int milliseconds,
size_t stack_size = 320000);
272 virtual void run(
void) = 0;
280 static void timer_callback(
ACL_FIBER* f,
void* ctx);
283 #if defined(ACL_CPP_API) 288 template <
typename T>
289 class fiber_trigger :
public fiber
292 fiber_trigger(timer_trigger<T>& timer)
299 virtual ~fiber_trigger(
void) {}
311 timer_trigger<T>& get_trigger(
void)
320 T* o = mbox_.pop(delay_);
324 long long next = timer_.trigger();
329 delay_ = next - curr;
340 timer_trigger<T>& timer_;
344 #endif // ACL_CPP_API
ACL_CPP_API int last_error(void)
struct ACL_FIBER ACL_FIBER
ACL_CPP_API const char * last_serror(void)
ACL_CPP_API long long get_curr_stamp(void)
virtual ~fiber_timer(void)