Make the event loop return shared_ptrs (#2842)

* Return shared_ptr from eventloop

* Add -Wdeprecated-copy-dtor warning

Produces a warning if classes don't have explicit copy operations if
they have a user-defined constructor.
This helps us stick to the rule of 5 (kinda, no warnings for missing
move operators).

* Clean up eventloop

* Fix compiler warnings

* Fix fs_event_handle_t name
This commit is contained in:
Patrick Ziegler
2022-10-15 23:21:40 +02:00
committed by GitHub
parent 54b75f23ab
commit 56779a5902
18 changed files with 266 additions and 144 deletions

View File

@ -262,11 +262,11 @@ int run(int argc, char** argv) {
*/
int idx = decoders.size() - 1;
auto& conn = loop.handle<PipeHandle>();
conn.connect(
auto conn = loop.handle<PipeHandle>();
conn->connect(
channel,
[&conn, &decoders, pid, type, payload, channel, idx]() {
on_connection(conn, decoders[idx], pid, type, payload);
on_connection(*conn, decoders[idx], pid, type, payload);
},
[&](const auto& e) {
fprintf(stderr, "%s: Failed to connect to '%s' (err: '%s')\n", exec, channel.c_str(), uv_strerror(e.status));