From 18f54f74862322d5a9360cbdc3541b6e3f15dce6 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 6 Mar 2020 11:24:08 -0400 Subject: Common/Fiber: Document fiber interexchange. --- src/common/fiber.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/common/fiber.h') diff --git a/src/common/fiber.h b/src/common/fiber.h index a710df257..3bbd506b5 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h @@ -28,7 +28,10 @@ namespace Common { * 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. + * threads will cause a deadlock. In order to prevent a deadlock, each thread should + * have an intermediary fiber, you switch to the intermediary fiber of the current + * thread and then from it switch to the expected fiber. This way you can exchange + * 2 fibers within 2 different threads. */ class Fiber { public: -- cgit v1.2.3