Debug and Release code have different behavior

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a multithreading application that reads and writes to com ports.

The debug version works with no problems, but the release version don't.
They are the same code, the difference is how the solution was compiled.

The problem is:
The release version fails to read from one of the com ports, and locks up
until the timeout is expired.
How I know? I created a log file to know what was happening to the release
version, and found where it locks up.

Any idea?

Carlos
 
Could be a timing issue causing a deadlock which you are only hit in the
release version because it runs faster without the debug code.

Look at your code for scenarios where 2 or more resources (e.g. COM ports)
are obtained in a different order on separate threads.

e.g. A & B are resources, 1 & 2 are threads:
following will deadlock - thread 2 gets B and is waiting for A, thread 1 has
A and is waiting for B
1 A...B
2 B....A

following is OK because thread 2 is slower - thread 1 has already released B
1 A...B
2 B....A
 
Back
Top