using System;
using System.Collections.Generic;
using System.Text;
namespace Apewer.Internals
{
/// 锁。
internal class Locker
{
Dictionary> _pool = new Dictionary>();
/// 标记指定的字符串。
static int Key(string s) => s == null ? 0 : s.GetHashCode();
/// 清除所有缓存的锁。
public void Clear()
{
lock (_pool)
{
_pool.Clear();
}
}
/// 锁定字符串,执行 Action。
public void InLock(string text, Action action)
{
if (action == null) return;
var key = Key(text);
Class