// ******************************************************************************* // // ******* *** *** * // * * * * // * * * ***** // * * *** * * ** * ** *** // * * * * * * * **** * * * // * * * * * * * * * * * // * *** *** * ** ** ** * * // * // ******************************************************************************* // see https://github.com/tgoessler/TCSystemCS for details. // Copyright (C) 2003 - 2026 Thomas Goessler. All Rights Reserved. // ******************************************************************************* // // TCSystem is the legal property of its developers. // Please refer to the COPYRIGHT file distributed with this source distribution. // // ******************************************************************************* #region Usings using System; using System.Threading.Tasks; #endregion namespace TCSystem.Thread; /// Provides disposable scopes for asynchronous update coordination. public static class AsyncUpdateHelperExt { #region Public /// Acquires a stop-requesting update scope that releases the helper when disposed. public static async Task BeginUpdateScopeAsync(this IAsyncUpdateHelper asyncUpdateHelper) { await asyncUpdateHelper.BeginUpdateAsync(); return new AsyncUpdateScope(asyncUpdateHelper); } /// Acquires an ordinary update scope that releases the helper when disposed. public static async Task WaitScopeAsync(this IAsyncUpdateHelper asyncUpdateHelper) { await asyncUpdateHelper.WaitAsync(); return new AsyncUpdateScope(asyncUpdateHelper); } #endregion }