summaryrefslogtreecommitdiffstats
path: root/src/common/fiber.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-05 20:48:20 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-18 22:29:15 +0200
commitbe320a9e10fda32a984b12cdfe3aaf09cc67b39a (patch)
treef2bb28be6adc2a416b59393bb8f438636e9c79c1 /src/common/fiber.h
parentTests: Add tests for fibers and refactor/fix Fiber class (diff)
downloadyuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar
yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.gz
yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.bz2
yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.lz
yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.xz
yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.tar.zst
yuzu-be320a9e10fda32a984b12cdfe3aaf09cc67b39a.zip
Diffstat (limited to '')
-rw-r--r--src/common/fiber.h14
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 {
namespace Common {
+/**
+ * Fiber class
+ * a fiber is a userspace thread with it's own context. They can be used to
+ * implement coroutines, emulated threading systems and certain asynchronous
+ * patterns.
+ *
+ * This class implements fibers at a low level, thus allowing greater freedom
+ * to implement such patterns. This fiber class is 'threadsafe' only one fiber
+ * can be running at a time and threads will be locked while trying to yield to
+ * a running fiber until it yields. WARNING exchanging two running fibers between
+ * threads will cause a deadlock.
+ */
class Fiber {
public:
Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter);
@@ -53,8 +65,6 @@ private:
static void FiberStartFunc(boost::context::detail::transfer_t transfer);
#endif
-
-
struct FiberImpl;
SpinLock guard;