> I have some type of subtle race condition in my multithreaded app that
> causes a very occasional program crash (always in the field, of
> course!)

Yes, it always happens like that!

> I'm stumped about how to track it down. Also, it would be nice if I
> could somehow prove that there were no other race conditions in my
> code.

That's like expecting some method to 'prove' there are no bugs in your code.
Let's face it: we all write bugs from time to time.  It's only a matter of
thoroughly testing and careful design and implementation which can make
someone's code more robust than the others.

> How do you certify that your multithreaded app is robust? Are there
> any tools that would be useful?

There are several commercial tools which claim to 'analyze' your code to
find potential race conditions.  I have not personally tried any of them, so
I can't comment on them.

But what I would usually suggest is extensive logging.  Note: don't use
anything like DebugBreak( ) or MessageBox( ) which cause a thread to be
suspended, and hence, change the program execution order.  This is critical.
If you don't follow it, your app will never be tested in real world
conditions.

Try to optimize your logging code so that it doesn't take a lot of time to
execute.  Heavy logging can also change the program execution order; you
should also be aware of that.

> I was thinking there should be a way to control a program's threads
> from the outside and write a script to test every path, but I don't
> know if that's possible.

I don't know of any such tool, but I'd be quite interested to know if there
is one.

-------------
Ehsan Akhgari

Farda Technology (http://www.farda-tech.com/)

List Owner: [EMAIL PROTECTED]

[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]

To these men of today will I not be light, nor be called light. Them- will I
blind: lightning of my wisdom!
-Thus Spoke Zarathustra, F. W. Nietzsche





Reply via email to