From 3ed0c3c0bef2eefddcf2033e6ab9d22cf45c486d Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 7 Jun 2018 21:37:18 -0700 Subject: base: Add a class which encapsulates Fibers. This class encapsulates the idea of a Fiber in such a way that other implementations can be substituted in in the future. This implementation uses the ucontext family of functions. This change also adds a new unit test which exercises the new class. It creates three new fibers which accept a sequence of other fibers to switch to, one after the other. The main test function switches to the these fibers which switch with each other and occasionally back to the main fiber. Each time a test fiber is activated, it checks against a list which shows the correct order for the fibers to run in. When the main fiber gets control, it makes sure that list has been progressed through by the correct amount. Change-Id: I1fc2afa414b51baaa91e350a4ebc791d989f0b8a Reviewed-on: https://gem5-review.googlesource.com/10935 Reviewed-by: Giacomo Travaglini Maintainer: Gabe Black --- src/base/SConscript | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/base/SConscript') diff --git a/src/base/SConscript b/src/base/SConscript index a90b78486..b3205a6bb 100644 --- a/src/base/SConscript +++ b/src/base/SConscript @@ -46,6 +46,8 @@ if env['USE_FENV']: Source('fenv.c') if env['USE_PNG']: Source('pngwriter.cc') +Source('fiber.cc') +GTest('fibertest', 'fibertest.cc', 'fiber.cc') Source('framebuffer.cc') Source('hostinfo.cc') Source('inet.cc') -- cgit v1.2.3