base: Add a new type of CallbackQueue.
This type is templated on what arguments the callbacks in it accept, and it inherits directly from std::list instead of containing one and forwarding selected members. This version is called CallbackQueue2, but once all CallbackQueue instances have been replaced it will be renamed to CallbackQueue. Issue-on: https://gem5.atlassian.net/browse/GEM5-698 Change-Id: I32ab7454ea8c6a2af31cbcf5d4932a069ace1cb5 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32642 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#ifndef __BASE_CALLBACK_HH__
|
||||
#define __BASE_CALLBACK_HH__
|
||||
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
@@ -79,6 +80,21 @@ class MakeCallback : public Callback
|
||||
void process() { (object->*F)(); }
|
||||
};
|
||||
|
||||
class CallbackQueue2 : public std::list<std::function<void()>>
|
||||
{
|
||||
public:
|
||||
using Base = std::list<std::function<void()>>;
|
||||
|
||||
using Base::Base;
|
||||
|
||||
void
|
||||
process()
|
||||
{
|
||||
for (auto &f: *this)
|
||||
f();
|
||||
}
|
||||
};
|
||||
|
||||
class CallbackQueue
|
||||
{
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user