コード例 #1
0
ファイル: IRContext.cs プロジェクト: ericjohnsohnisc/ILGPU
        /// <summary>
        /// Tries to resolve the given handle to a top-level function.
        /// </summary>
        /// <param name="handle">The function handle to resolve.</param>
        /// <param name="function">The resolved function (if any).</param>
        /// <returns>True, if the requested function could be resolved.</returns>
        public bool TryGetMethod(MethodHandle handle, out Method function)
        {
            if (handle.IsEmpty)
            {
                function = null;
                return(false);
            }

            // Synchronize all accesses below using a read scope
            using var readScope = irLock.EnterUpgradeableReadScope();

            return(methods.TryGetData(handle, out function));
        }
コード例 #2
0
        /// <summary>
        /// Tries to resolve the given handle to a top-level function.
        /// </summary>
        /// <param name="handle">The function handle to resolve.</param>
        /// <param name="function">The resolved function (if any).</param>
        /// <returns>True, if the requested function could be resolved.</returns>
        public bool TryGetMethod(MethodHandle handle, out Method function)
        {
            if (handle.IsEmpty)
            {
                function = null;
                return(false);
            }

            irLock.EnterReadLock();
            try
            {
                return(methods.TryGetData(handle, out function));
            }
            finally
            {
                irLock.ExitReadLock();
            }
        }