Skip to content

Commit

Permalink
Use io_context rather than io_service alias.
Browse files Browse the repository at this point in the history
boost::asio::io_service is only for backwards compatibility.
  • Loading branch information
ChrisCummins committed Mar 6, 2022
1 parent 0af9321 commit 3c19686
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler_gym/envs/llvm/service/Cost.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ Status getTextSizeInBytes(llvm::Module& module, int64_t* value, const fs::path&
fmt::format("{} -w -xir - -o {} -c", clangPath.string(), tmpFile.string());
#endif

boost::asio::io_service clangService;
boost::asio::io_context clangContext;
auto stdinBuffer{boost::asio::buffer(ir)};
bp::async_pipe stdinPipe(clangService);
bp::async_pipe stdinPipe(clangContext);
boost::asio::io_context clangStderrStream;
std::future<std::string> clangStderrFuture;

Expand All @@ -88,8 +88,8 @@ Status getTextSizeInBytes(llvm::Module& module, int64_t* value, const fs::path&
stdinPipe, stdinBuffer,
[&](const boost::system::error_code& ec, std::size_t n) { stdinPipe.async_close(); });

clangService.run_for(std::chrono::seconds(60));
if (clangService.poll()) {
clangContext.run_for(std::chrono::seconds(60));
if (clangContext.poll()) {
return Status(StatusCode::INVALID_ARGUMENT,
fmt::format("Failed to compute .text size cost within 60 seconds"));
}
Expand Down

0 comments on commit 3c19686

Please sign in to comment.