• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版a8271af2f8913c1486fdf754cc13eb54e3ecf28f (tree)
时间2020-11-22 21:17:24
作者Alexander Larin <scalar438@gmai...>
CommiterAlexander Larin

Log Message

Run async_checker

更改概述

差异

diff -r e7f2985138c0 -r a8271af2f891 libs/checklib/details/i_process.hpp
--- a/libs/checklib/details/i_process.hpp Sun Nov 22 09:42:02 2020 +0300
+++ b/libs/checklib/details/i_process.hpp Sun Nov 22 15:17:24 2020 +0300
@@ -6,7 +6,7 @@
66 {
77
88 enum ProcessStatus;
9-class ProcessExecuteParameters;
9+struct ProcessExecuteParameters;
1010
1111 namespace details
1212 {
@@ -31,9 +31,6 @@
3131
3232 [[nodiscard]] virtual bool is_abnormal_exit() const = 0;
3333
34- // Start the process
35- virtual void start(const ProcessExecuteParameters &) = 0;
36-
3734 /// Peak memory usage, in bytes for the process
3835 [[nodiscard]] virtual int peak_memory_usage() = 0;
3936
diff -r e7f2985138c0 -r a8271af2f891 libs/checklib/details/rp_win.h
--- a/libs/checklib/details/rp_win.h Sun Nov 22 09:42:02 2020 +0300
+++ b/libs/checklib/details/rp_win.h Sun Nov 22 15:17:24 2020 +0300
@@ -91,6 +91,12 @@
9191 // Сколько процессорного времени израсходовал процесс
9292 int cpu_time() override;
9393
94+ bool is_abnormal_exit() const override
95+ {
96+ // FIXME: not implemented yet
97+ return true;
98+ }
99+
94100 void reset();
95101
96102 Limits getLimits() const;
diff -r e7f2985138c0 -r a8271af2f891 libs/checklib/process.cpp
--- a/libs/checklib/process.cpp Sun Nov 22 09:42:02 2020 +0300
+++ b/libs/checklib/process.cpp Sun Nov 22 15:17:24 2020 +0300
@@ -20,14 +20,19 @@
2020 // Platform-dependent process wrapper
2121 std::unique_ptr<details::IProcess> process;
2222
23+ std::future<void> async_checker_fut;
24+
2325 ProcessExecuteParameters parameters;
2426 };
2527
2628 checklib::Process::Process(ProcessExecuteParameters params) : pimpl(new Pimpl)
2729 {
2830 pimpl->parameters = std::move(params);
29- pimpl->process = details::IProcess::create();
30- pimpl->process->start(pimpl->parameters);
31+ auto process = std::make_unique<details::RestrictedProcessImpl>(pimpl->parameters);
32+ process->start();
33+ pimpl->process = std::move(process);
34+ pimpl->async_checker_fut =
35+ std::async(details::async_checker, pimpl->process.get(), pimpl->parameters.limits, nullptr);
3136 }
3237
3338 checklib::Process::Process() : pimpl(new Pimpl)
@@ -100,7 +105,7 @@
100105 // Запуск процесса
101106 void checklib::Process::start()
102107 {
103- pimpl->process->start(pimpl->parameters);
108+ // TODO: remove this method
104109 }
105110
106111 // Завершает процесс вручную. Тип завершения становится etTerminated