Commit bcafdb77 authored by Kenton Varda's avatar Kenton Varda

GCC fixes.

parent a0e2a45f
...@@ -133,6 +133,7 @@ includekj_HEADERS = \ ...@@ -133,6 +133,7 @@ includekj_HEADERS = \
src/kj/mutex.h \ src/kj/mutex.h \
src/kj/thread.h \ src/kj/thread.h \
src/kj/async.h \ src/kj/async.h \
src/kj/async-unix.h \
src/kj/main.h src/kj/main.h
includekjparse_HEADERS = \ includekjparse_HEADERS = \
...@@ -183,6 +184,7 @@ libkj_la_SOURCES= \ ...@@ -183,6 +184,7 @@ libkj_la_SOURCES= \
src/kj/mutex.c++ \ src/kj/mutex.c++ \
src/kj/thread.c++ \ src/kj/thread.c++ \
src/kj/async.c++ \ src/kj/async.c++ \
src/kj/async-unix.c++ \
src/kj/main.c++ \ src/kj/main.c++ \
src/kj/parse/char.c++ src/kj/parse/char.c++
...@@ -323,6 +325,7 @@ capnp_test_SOURCES = \ ...@@ -323,6 +325,7 @@ capnp_test_SOURCES = \
src/kj/function-test.c++ \ src/kj/function-test.c++ \
src/kj/mutex-test.c++ \ src/kj/mutex-test.c++ \
src/kj/async-test.c++ \ src/kj/async-test.c++ \
src/kj/async-unix-test.c++ \
src/kj/parse/common-test.c++ \ src/kj/parse/common-test.c++ \
src/kj/parse/char-test.c++ \ src/kj/parse/char-test.c++ \
src/capnp/common-test.c++ \ src/capnp/common-test.c++ \
......
...@@ -61,20 +61,24 @@ public: ...@@ -61,20 +61,24 @@ public:
} }
} }
template <typename... Params> template <typename Param>
void fire(Params&&... params) const { void fire(Param&& param) const {
// If the listener has not yet dropped its pointer to the Item, invokes the item's `fire()` // If the listener has not yet dropped its pointer to the Item, invokes the item's `fire()`
// method with the given parameters. // method with the given parameters.
//
// TODO(someday): This ought to be a variadic template, letting you pass any number of
// params. However, GCC 4.7 and 4.8 appear to get confused by param packs used inside
// lambdas. Clang handles it fine.
doOnce([&]() { doOnce([&]() {
const_cast<Item&>(item).fire(kj::fwd<Params>(params)...); const_cast<Item&>(item).fire(kj::fwd<Param>(param));
}); });
} }
private: private:
Item item; Item item;
mutable _::Once once; mutable _::Once once;
uint refcount = 2; mutable uint refcount = 2;
ItemWrapper* next = nullptr; ItemWrapper* next = nullptr;
// The ItemWrapper cannot be destroyed until this pointer becomes non-null. // The ItemWrapper cannot be destroyed until this pointer becomes non-null.
...@@ -248,7 +252,7 @@ private: ...@@ -248,7 +252,7 @@ private:
// updating this pointer, so there's a chance it will remain behind indefinitely (if two threads // updating this pointer, so there's a chance it will remain behind indefinitely (if two threads
// adding items at the same time race to update `tail`), but it should not be too far behind. // adding items at the same time race to update `tail`), but it should not be too far behind.
NewWorkCallback* newWorkCallback = nullptr; mutable NewWorkCallback* newWorkCallback = nullptr;
}; };
// ======================================================================================= // =======================================================================================
......
...@@ -92,7 +92,7 @@ private: ...@@ -92,7 +92,7 @@ private:
Own<Impl> impl; Own<Impl> impl;
pthread_t waitThread; pthread_t waitThread;
bool isSleeping = false; mutable bool isSleeping = false;
}; };
} // namespace kj } // namespace kj
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment