c# 并行计算 Parallel

            //多重认证
            Parallel.Invoke(() =>
            {
                jianYanResult = new VerifiedMobileService().CheckMobileFun(request.phone_number);
                LogUtils.Debug("const_id:" + request.const_id + " mobile:" + phone_number + " MobileFun", "PassJianYan", "01");

            }, () =>
            {
                dxResult = SecRiskApi(request);
                LogUtils.Debug("const_id:" + request.const_id + " mobile:" + phone_number + " RISK", "PassJianYan", "02");
            });

  

jianYanResult 、dxResult 为前置定义变量; 两个代码块并行执行;

posted @ 2019-07-08 14:41  cn_king  阅读(349)  评论(0编辑  收藏  举报