> I'm trying to use fopen (FILE, "r") to check for file existence now
I didn't see an fclose()
You're absolutely sure that CheckSODFile(); is being called when it's inside the if statement?
Is bStartOfDay not being set, or are you relying on your trace output from ConsolePrintf?.
From past experience, if you try and log too much information in a short space of time, then some logging systems will drop some output, giving you the impression that something isn't happening, when in reality it is.
Do you have any kind of debugger?
What does this do?
Code:
CheckSODFile(); // works?
if (bLesResent == TRUE) // Set in ResendLesThread - okay
{
CheckSODFile(); // Still doesn't work!!!
}
Perhaps adding this to your code may help
Code:
int CheckSODFile_count=0;
void CheckSODFile(void)
{
CheckSODFile_count++;
// rest of code
}
Then at some point later, either using a debugger or using ConsolePrintf, look at the counter and see if that matches your expectations.
In gcc at least, the increment of a variable like that takes one instruction, so even if its being called rapidly by multiple threads, the count should still be accurate.
> This is an old program (1992) which I am adding new functionality to
Ouch!
This could be a lot trickier then.
My first step would be to compile the original code with the new compiler and libraries and make sure it still works. This would at least eliminate some possibilities that the original code was not as thread safe as it ought to be.