From 9effc613a708237383938955c1ab89ab082d6ad4 Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期一, 21 七月 2025 10:10:06 +0800 Subject: [PATCH] 1 --- HnSx/Build/Project/代码/VS自定义类/AutoThread.cs | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git "a/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" "b/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" index e399482..a4d73a5 100644 --- "a/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" +++ "b/HnSx/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" @@ -120,8 +120,29 @@ /// <param name="action"></param> public void ThreadSettingInit(Tag tag) { + List<Task> tasks = new List<Task>(); + //tasks.Add(GetTask(sa2008, tag, 3000)); + Task.WaitAll(tasks.ToArray()); - + } + private Task GetTask(Action<Tag> action, Tag tag, int i = 2500) + { + var task = Task.Run(() => + { + while (true) + { + try + { + action(tag); + } + catch (Exception ex) + { + LogHelper.Error(ex.Message, ex); + } + Thread.Sleep(i); + } + }); + return task; } public async void ThreadwebSoc() @@ -216,7 +237,7 @@ public class HttpServer { public static readonly HttpHelper apiHelper = new HttpHelper(); - System.Net.HttpListener HttpSvcHost = null; + public static System.Net.HttpListener HttpSvcHost = null; public static string _listenerPrefix = ""; public HttpServer(string ip) -- Gitblit v1.9.1