Closed cboulay closed 4 years ago
The basic technique (as suggested here) is
auto keepalive = shared_from_this();
async_write(*sock_, lslboost::asio::buffer(serv_->fullinfo_msg_),
[keepalive, this](err_t, std::size_t) { /* shared pointer 'keepalive' is kept alive until the end of this callback */ });
this
is also captured so object methods can be called without prefixing keepalive->
, but IIRC in this case the lambda function just called an empty method so I removed the call. So, XCode is right and the this
can be safely removed.
I've opened a PR (#69) for it.
https://github.com/sccn/liblsl/blob/master/src/tcp_server.cpp#L293
Xcode warning -
Lambda capture 'this' is not used
Do we not need to handle any errors here?