Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Menghentikan simulasi
GunakanResult<void> DestroyApplication(Application&& app)
untuk menghentikan aplikasi dan simulasi.
Aplikasi lain mengetahui bahwa simulasi dimatikan ketika mereka menerimaErrorCode::ShuttingDown
dari panggilan mereka keBeginUpdateWillBlock()
atauBeginUpdate()
. Saat aplikasi menerimaErrorCode::ShuttingDown
, aplikasi dapat memanggilResult<void> DestroyApplication(Application&& app)
untuk mengakhiri dirinya sendiri.
contoh Contoh
Result<void> AppDriver::EncounteredAppError(Application&& application) noexcept { const ErrorCode errorCode = WEAVERRUNTIME_EXPECT_ERROR(runAppResult); switch (errorCode) { case ErrorCode::ShuttingDown: { // insert custom shutdown process here. WEAVERRUNTIME_TRY(Api::DestroyApplication(std::move(application))); return Success(); } default: { OnAppError(errorCode); return errorCode; } } }
Hanya meneleponResult<void> DestroyApplication(Application&& app)
setelahApi::Commit()
. Menghancurkan aplikasi selama pembaruan dapat menyebabkan perilaku tidak terdefinisi.
Anda harus meneleponDestroyApplication()
sebelum program keluar untuk memastikan bahwa laporan aplikasi sebagai mengakhiri berhasil.
Kegagalan untuk meneleponDestroyApplication()
ketika program keluar akan menyebabkan status dianggap sebagaiFATAL
.