blob: 3ea776d5c3d39a61a736a1da618bd394b21a3cea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* $Id$ */
/** @file fiber.hpp */
#ifndef FIBER_HPP
#define FIBER_HPP
typedef void (CDECL *FiberFunc)(void *);
class Fiber {
public:
/**
* Switch to this fiber.
*/
virtual void SwitchToFiber() = 0;
/**
* Exit a fiber.
*/
virtual void Exit() = 0;
/**
* Check if a fiber is running.
*/
virtual bool IsRunning() = 0;
/**
* Get the 'param' data of the Fiber.
*/
virtual void *GetFiberData() = 0;
/**
* Virtual Destructor to mute warnings.
*/
virtual ~Fiber() {};
/**
* Create a new fiber, calling proc(param) when running.
*/
static Fiber *New(FiberFunc proc, void *param);
/**
* Attach a current thread to a new fiber.
*/
static Fiber *AttachCurrent(void *param);
/**
* Get the 'param' data of the current active Fiber.
*/
static void *GetCurrentFiberData();
};
#endif /* FIBER_HPP */
|