1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2024-10-27 20:34:20 +00:00

give capnp ownership of process output fd

this fixes an intermittent issue (race condition?) where
the IoContext attempts to poll an already-closed fd
This commit is contained in:
Oliver Giles 2017-07-31 08:53:50 +03:00
parent 668ada74d1
commit 3068180f8e
2 changed files with 1 additions and 2 deletions

View File

@ -518,7 +518,6 @@ void Laminar::reapAdvance() {
std::shared_ptr<Run> run = *it;
bool completed = true;
activeJobs.get<0>().modify(it, [&](std::shared_ptr<Run> run){
close(run->fd);
run->reaped(ret);
completed = stepRun(run);
});

View File

@ -389,7 +389,7 @@ void Server::stop() {
}
void Server::addDescriptor(int fd, std::function<void(char*,size_t)> cb) {
auto event = this->ioContext.lowLevelProvider->wrapInputFd(fd);
auto event = this->ioContext.lowLevelProvider->wrapInputFd(fd, kj::LowLevelAsyncIoProvider::TAKE_OWNERSHIP);
tasks.add(handleFdRead(event, cb).attach(std::move(event)));
}