internal static IMiniAwaitable <object> Push(int messgaeId, int rpcId, object message, IObjectMessageReceiver r) { MiniTask <object> task1 = MiniTask <object> .Rent(); async void action() { //此处可以忽略异常处理 var response = await r.Deal(messgaeId, rpcId, message); if (response is Task <object> task) { response = await task; } if (response is ValueTask <object> vtask) { response = await vtask; } task1.SetResult(response); } receivePool.Enqueue(action); return(task1); }
internal static IMiniAwaitable <object> Push(int rpcID, object message, IObjectMessageReceiver r) { MiniTask <object> task1 = MiniTask <object> .Rent(); Action action = async() => { ///此处可以忽略异常处理 /// var response = await r.Deal(rpcID, message); if (response is Task <object> task) { response = await task; } if (response is ValueTask <object> vtask) { response = await vtask; } task1.SetResult(response); }; receivePool.Enqueue(action); return(task1); }