public Calculator(LockType lockType, int lower, int upper, int modulus, int threads, ProgramMode programMode, string hash)
        {
            this.lower = lower; this.upper = upper;
            this.modulus = modulus; this.threads = threads;
            this.hash = hash;

            LockObject locker = CreateLocker(lockType);
            loop = CreateLoop(locker, programMode);
        }
Пример #2
0
 public void Do(LoopObject.Do d, int i)
 {
     while (locked == 1 || Interlocked.Exchange(ref locked, 1) == 1);
     d(i);
     locked = 0;
 }