Skip to content

Commit

Permalink
Move close async to correct place.
Browse files Browse the repository at this point in the history
Add call to flush async.
  • Loading branch information
MarekKnapek committed May 25, 2024
1 parent 1e777c1 commit d617b9a
Showing 1 changed file with 52 additions and 49 deletions.
101 changes: 52 additions & 49 deletions mk_clib/src/mk_clib_app_vc.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_roun
return 0;
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_decrypt_impl_5(mk_clib_app_vc_pt const vc) mk_lang_noexcept
mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_decrypt_impl_4(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
mk_lang_types_sint_t err;

Expand All @@ -774,50 +774,6 @@ mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_decr
return 0;
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_close_async(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
#if mk_sl_io_async_thread_needs
mk_lang_types_sint_t err_a;
mk_lang_types_sint_t err_b;

mk_lang_assert(vc);

err_a = mk_sl_io_async_thread_join(&vc->m_io_async_thread);
err_b = mk_sl_io_async_thread_destroy(&vc->m_io_async_thread);
mk_lang_check_rereturn(err_a);
mk_lang_check_rereturn(err_b);
return 0;
#else
mk_lang_assert(vc);

((mk_lang_types_void_t)(vc));
return 0;
#endif
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_decrypt_impl_4(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
#if mk_sl_io_async_thread_needs
mk_lang_types_sint_t err;
mk_lang_types_sint_t err_b;

mk_lang_assert(vc);

err = mk_sl_io_async_thread_create(&vc->m_io_async_thread); mk_lang_check_rereturn(err);
err_b = mk_clib_app_vc_decrypt_impl_5(vc);
err = mk_clib_app_vc_close_async(vc); mk_lang_check_rereturn(err);
mk_lang_check_rereturn(err_b);
return 0;
#else
mk_lang_types_sint_t err;

mk_lang_assert(vc);

err = mk_clib_app_vc_decrypt_impl_5(vc); mk_lang_check_rereturn(err);
return 0;
#endif
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_threads_job_impl_1(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
#if mk_lib_mt_thread_has
Expand Down Expand Up @@ -1248,7 +1204,7 @@ mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_vhd_
return 0;
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work_impl_6(mk_clib_app_vc_pt const vc) mk_lang_noexcept
mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work_impl_7(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
mk_lang_types_sint_t err;
mk_lang_types_ulong_t tul;
Expand All @@ -1265,6 +1221,9 @@ mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work
err = mk_clib_app_vc_vhd_write_header_and_align(vc); mk_lang_check_rereturn(err);
err = mk_clib_app_vc_decrypt(vc); mk_lang_check_rereturn(err);
err = mk_clib_app_vc_vhd_write_footer(vc); mk_lang_check_rereturn(err);
#if mk_sl_io_async_thread_needs
err = mk_sl_io_async_thread_flush(&vc->m_io_async_thread); mk_lang_check_rereturn(err);
#endif
return 0;
}

Expand Down Expand Up @@ -1307,15 +1266,15 @@ mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_open
return 0;
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work_impl_5(mk_clib_app_vc_pt const vc) mk_lang_noexcept
mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work_impl_6(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
mk_lang_types_sint_t err;
mk_lang_types_sint_t err_b;

mk_lang_assert(vc);

err = mk_clib_app_vc_open_writer(vc); mk_lang_check_rereturn(err);
err_b = mk_clib_app_vc_work_impl_6(vc);
err_b = mk_clib_app_vc_work_impl_7(vc);
err = mk_sl_io_async_writer_file_close(&vc->m_writer); mk_lang_check_rereturn(err);
mk_lang_check_rereturn(err_b);
return 0;
Expand Down Expand Up @@ -1407,16 +1366,60 @@ mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_head
return 0;
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work_impl_4(mk_clib_app_vc_pt const vc) mk_lang_noexcept
mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work_impl_5(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
mk_lang_types_sint_t err;

mk_lang_assert(vc);

err = mk_sl_io_async_iocp_associate_r(&vc->m_iocp, &vc->m_reader, mk_clib_app_vc_iocp_idx_reader); mk_lang_check_rereturn(err);
err = mk_clib_app_vc_header(vc); mk_lang_check_rereturn(err);
err = mk_clib_app_vc_work_impl_6(vc); mk_lang_check_rereturn(err);
return 0;
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_close_async(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
#if mk_sl_io_async_thread_needs
mk_lang_types_sint_t err_a;
mk_lang_types_sint_t err_b;

mk_lang_assert(vc);

err_a = mk_sl_io_async_thread_join(&vc->m_io_async_thread);
err_b = mk_sl_io_async_thread_destroy(&vc->m_io_async_thread);
mk_lang_check_rereturn(err_a);
mk_lang_check_rereturn(err_b);
return 0;
#else
mk_lang_assert(vc);

((mk_lang_types_void_t)(vc));
return 0;
#endif
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_work_impl_4(mk_clib_app_vc_pt const vc) mk_lang_noexcept
{
#if mk_sl_io_async_thread_needs
mk_lang_types_sint_t err;
mk_lang_types_sint_t err_b;

mk_lang_assert(vc);

err = mk_sl_io_async_thread_create(&vc->m_io_async_thread); mk_lang_check_rereturn(err);
err_b = mk_clib_app_vc_work_impl_5(vc);
err = mk_clib_app_vc_close_async(vc); mk_lang_check_rereturn(err);
mk_lang_check_rereturn(err_b);
return 0;
#else
mk_lang_types_sint_t err;

mk_lang_assert(vc);

err = mk_clib_app_vc_work_impl_5(vc); mk_lang_check_rereturn(err);
return 0;
#endif
}

mk_lang_nodiscard static mk_lang_inline mk_lang_types_sint_t mk_clib_app_vc_open_reader(mk_clib_app_vc_pt const vc) mk_lang_noexcept
Expand Down

0 comments on commit d617b9a

Please sign in to comment.