예제 #1
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="context"></param>
 private static void Remove(KingContext context)
 {
     lock (syncRoot)
     {
         list.Remove(context);
     }
 }
예제 #2
0
 /// <summary>
 /// 添加http数据上下文
 /// </summary>
 /// <param name="context">http数据上下文</param>
 public static void Add(KingContext context)
 {
     lock (syncRoot)
     {
         list.Add(context);
         var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1d));
         cts.Token.Register(() => Remove(context));
     }
 }