Esempio n. 1
0
        public ConcurrentHashSet(ConcurrentLevel concurrentLevel, Func <T, T, bool> compare, Func <T, int> hash)
        {
            var level = (int)concurrentLevel;

            rwLockSlims = new ReaderWriterLockSlim[level];
            hashSets    = new HashSet <T> [level];
            for (byte i = 0; i < level; i++)
            {
                rwLockSlims[i] = new ReaderWriterLockSlim();
                if (compare != null && hash != null)
                {
                    hashSets[i] = new HashSet <T>(new WrapperEqualityComparer <T>(compare, hash));
                }
                else
                {
                    hashSets[i] = new HashSet <T>();
                }
            }
        }
Esempio n. 2
0
 public ConcurrentHashSet(ConcurrentLevel concurrentLevel) : this(concurrentLevel, null, null)
 {
 }