diff options
Diffstat (limited to 'src/common/fiber.h')
| -rw-r--r-- | src/common/fiber.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/common/fiber.h b/src/common/fiber.h index 812d6644a..89a01fdd8 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h | |||
| @@ -18,6 +18,18 @@ namespace boost::context::detail { | |||
| 18 | 18 | ||
| 19 | namespace Common { | 19 | namespace Common { |
| 20 | 20 | ||
| 21 | /** | ||
| 22 | * Fiber class | ||
| 23 | * a fiber is a userspace thread with it's own context. They can be used to | ||
| 24 | * implement coroutines, emulated threading systems and certain asynchronous | ||
| 25 | * patterns. | ||
| 26 | * | ||
| 27 | * This class implements fibers at a low level, thus allowing greater freedom | ||
| 28 | * to implement such patterns. This fiber class is 'threadsafe' only one fiber | ||
| 29 | * can be running at a time and threads will be locked while trying to yield to | ||
| 30 | * a running fiber until it yields. WARNING exchanging two running fibers between | ||
| 31 | * threads will cause a deadlock. | ||
| 32 | */ | ||
| 21 | class Fiber { | 33 | class Fiber { |
| 22 | public: | 34 | public: |
| 23 | Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter); | 35 | Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter); |
| @@ -53,8 +65,6 @@ private: | |||
| 53 | static void FiberStartFunc(boost::context::detail::transfer_t transfer); | 65 | static void FiberStartFunc(boost::context::detail::transfer_t transfer); |
| 54 | #endif | 66 | #endif |
| 55 | 67 | ||
| 56 | |||
| 57 | |||
| 58 | struct FiberImpl; | 68 | struct FiberImpl; |
| 59 | 69 | ||
| 60 | SpinLock guard; | 70 | SpinLock guard; |