使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
6. 退出沙盒
您必须根据沙盒的运行方式(请参阅此步骤)调整终止沙盒的方式,从而同时调整 Sandboxee 的方式。
退出同步运行的沙盒
如果沙盒已在同步运行,则“Run”仅在 Sandboxee 完成后返回。因此,您无需执行任何额外步骤即可终止帐号。以下代码段展示了这种情况:
Sandbox2::Result result = s2.Run();
LOG(INFO) << "Final execution status: " << result.ToString();
退出异步运行的沙盒
如果沙盒是异步运行的,则可以使用两个选项来终止。首先,您只需等待 Sandboxee 完成,然后接收最终的执行状态即可:
sandbox2::Result result = s2.AwaitResult();
LOG(INFO) << "Final execution status: " << result.ToString();
或者,您也可以随时终止 Sandboxee,但仍建议调用 AwaitResult()
,因为在此期间 Sandboxee 可能会因其他原因而终止:
s2.Kill();
sandbox2::Result result = s2.AwaitResult();
LOG(INFO) << "Final execution status: " << result.ToString();
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-06。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2023-12-06。"],[[["Exiting a synchronously running sandbox requires no extra steps as the `Run` function only returns after the Sandboxee is finished."],["Asynchronously running sandboxes can be terminated by waiting for completion with `AwaitResult()` or by forcefully killing the Sandboxee with `Kill()` followed by `AwaitResult()` to retrieve the final status."]]],[]]