Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! src: split out callback queue implementation from Environment
  • Loading branch information
addaleax committed May 6, 2020
commit a9470f0976a3e7d094ab96553140fe36a8327542
2 changes: 1 addition & 1 deletion src/callback_queue-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ CallbackQueue<R, Args...>::CallbackImpl<Fn>::CallbackImpl(

template <typename R, typename... Args>
template <typename Fn>
R CallbackQueue<R, Args...>::CallbackImpl<Fn>::Call(Args&&... args) {
R CallbackQueue<R, Args...>::CallbackImpl<Fn>::Call(Args... args) {
return callback_(std::forward<Args>(args)...);
}

Expand Down
10 changes: 8 additions & 2 deletions src/callback_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

namespace node {

// A queue of C++ functions that take Args... as arguments and return R
// (this is similar to the signature of std::function).
// New entries are added using `CreateCallback()`/`Push()`, and removed using
// `Shift()`.
// The `refed` flag is left for easier use in situations in which some of these
// should be run even if nothing else is keeping the event loop alive.
template <typename R, typename... Args>
Comment thread
addaleax marked this conversation as resolved.
class CallbackQueue {
public:
Expand All @@ -15,7 +21,7 @@ class CallbackQueue {
explicit inline Callback(bool refed);

virtual ~Callback() = default;
virtual R Call(Args&&... args) = 0;
virtual R Call(Args... args) = 0;

inline bool is_refed() const;

Expand Down Expand Up @@ -46,7 +52,7 @@ class CallbackQueue {
class CallbackImpl final : public Callback {
public:
CallbackImpl(Fn&& callback, bool refed);
R Call(Args&&... args) override;
R Call(Args... args) override;

private:
Fn callback_;
Expand Down