Changeset 1356


Ignore:
Timestamp:
Apr 25, 2010, 7:28:48 PM (12 years ago)
Author:
pretzsch
Message:

o FIX MD5Collider: Prevention of race condition occuring when collision search has finished

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/MD5Collider/Algorithm/MultiThreadedMD5Collider.cs

    r1355 r1356  
    3232
    3333            progressUpdateTimer = new Timer();
    34             progressUpdateTimer.Interval = 100;
     34            progressUpdateTimer.Interval = 250;
    3535            progressUpdateTimer.Elapsed += progressUpdateTimer_Tick;
    3636        }
     
    6767        }
    6868
     69        private Object finishedLock = new Object();
     70
    6971        internal void SignalWorkIsFinished(IMD5ColliderAlgorithm successfulCollider)
    7072        {
    71             this.successfulCollider = successfulCollider;
    72             updateProgress();
    73             Stop();
     73            lock (finishedLock)
     74            {
     75                if (this.successfulCollider == null)
     76                {
     77                    this.successfulCollider = successfulCollider;
     78                    updateProgress();
     79                    Stop();
    7480
    75             finishedEvent.Set();
     81                    finishedEvent.Set();
     82                }
     83            }
    7684        }
    7785
     
    111119
    112120            finishedEvent.Reset();
     121            successfulCollider = null;
    113122
    114123            foreach (ColliderWorkerAdapter<T> worker in workers)
Note: See TracChangeset for help on using the changeset viewer.