From 9568f3a42b203e99f1772d95b0e0835f484ff75e Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Tue, 31 Jul 2018 15:57:35 +0200 Subject: [PATCH] Add Fiber::print() --- emper/Fiber.cpp | 16 ++++++++++++++-- emper/Fiber.hpp | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/emper/Fiber.cpp b/emper/Fiber.cpp index 479b2627..c6e578ca 100644 --- a/emper/Fiber.cpp +++ b/emper/Fiber.cpp @@ -13,7 +13,19 @@ void Fiber::run() const { std::ostream& operator<<(std::ostream& strm, const Fiber& fiber) { strm << "Fiber [ptr=" << &fiber << " func=" << fiber.function.target<void(void*)>() - << " arg=" << fiber.arg - << "]"; + << " arg=" << fiber.arg; + + if (fiber.affinity) { + strm << " aff=" << fiber.affinity; + } else { + strm << " aff=nullptr"; + } + + strm << "]"; + return strm; } + +void Fiber::print() const { + std::cout << this << std::endl; +} diff --git a/emper/Fiber.hpp b/emper/Fiber.hpp index 6d2de832..4a88f185 100644 --- a/emper/Fiber.hpp +++ b/emper/Fiber.hpp @@ -127,6 +127,8 @@ public: return *affinity; } + void print() const; + friend std::ostream& operator<<(std::ostream&, const Fiber&); static inline Fiber* from(fiber_fun_t function, void* arg) { -- GitLab