Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/32642 )
Change subject: base: Add a new type of CallbackQueue.
......................................................................
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 <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/base/callback.hh
1 file changed, 16 insertions(+), 0 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/callback.hh b/src/base/callback.hh
index f193361..cef28c3 100644
--- a/src/base/callback.hh
+++ b/src/base/callback.hh
@@ -29,6 +29,7 @@
#ifndef __BASE_CALLBACK_HH__
#define __BASE_CALLBACK_HH__
+#include <functional>
#include <list>
#include <string>
@@ -79,6 +80,21 @@
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:
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/32642
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I32ab7454ea8c6a2af31cbcf5d4932a069ace1cb5
Gerrit-Change-Number: 32642
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Mahyar Samani <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s