TMultiReadExclusiveWriteSynchronizer.EndWrite throw EAccessViolation


A TMultiReadExclusiveWriteSynchronizer that was initialized (in the initialization section of the unit) raised a EAccessViolation on attempt to EndWrite().
This happen suddently after many calls to the function containing the call to EndWrite()

How can that be?

(Delphi 6 Professinal)

Who is Participating?
AvonWyssConnect With a Mentor Commented:
A critical section is both smaller and cannot lead to deadlocks as long as only one CS is in use. However, I still would not expect any AV to happen.
Maybe the memory area whgere the object is stored in got overwritten, or its pointer was somehow corrupted? This is more often the case than you may think.
Deadlocks have nothing top do with AVs. Therefore, this bug (which actually is a conclusion of the way a TMultiReadExclusiveWriteSynchronizer works) has nothing to do with the problem mentionned here.

A deadlock happens when two (or more) threads are in a waiting state, each one waiting for the other one, therefore never existing the wait state.
mathoughtAuthor Commented:
I had both daed-locks and this AV.
When I moved to TCriticalSection, the problem disappeared.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.