MattNolan
07-28-2010, 07:13 PM
I have a program that currently hashes files, and then compares hashes linearly, I'm looking to change it so that it will hash a file, stick the hash and information about that file into a queue, and then have another thread compare that hash to a separate list and perform some simple operations.
basically it looks like this
Thread 1 Thread 2
Read in file Dequeue
Hash Compare Hashes
Enqueue Do Stuff
Somehow though, my queue is getting null values into it. My first hypothesis is that it is enqueue/dequeue at exactly the same time and causing the insert to happen before the deletion is fully in effect resulting in something like:
queue[1] = item
queue[2] = item
queue[3] = item
queue[4] = null
queue[5] = item
Right now I'm getting the error with null values getting into the queue, and another exception with message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. on a call to an outside dll that had never given me problems before.
basically it looks like this
Thread 1 Thread 2
Read in file Dequeue
Hash Compare Hashes
Enqueue Do Stuff
Somehow though, my queue is getting null values into it. My first hypothesis is that it is enqueue/dequeue at exactly the same time and causing the insert to happen before the deletion is fully in effect resulting in something like:
queue[1] = item
queue[2] = item
queue[3] = item
queue[4] = null
queue[5] = item
Right now I'm getting the error with null values getting into the queue, and another exception with message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. on a call to an outside dll that had never given me problems before.