I am analysing a crash dump and the crash dump is pointing here. semFile is a static oject and dp is internal object of semFile. This is happening in a multi threaded environment.
void cSemaphore::request (void)
{
dp->reqcnt++; // -----------------------------------------------------> crash dump points here
}
class dSemaphore
{
public:
CRITICAL_SECTION cs; // Windows critical section object
long threadid; // owning thread id
int reqcnt; // current request count
int owncnt; // current ownership count
long totreqs; // total request count
};
cSemaphore::cSemaphore(void)
{
dp = new dSemaphore; // allocate data object
InitializeCriticalSection(&dp->cs); // init critical section
dp->reqcnt = 0;
dp->owncnt = 0;
dp->totreqs = 0;
dp->threadid = 0;
}
Calling function:
// Multiple thread call this function
static unsigned Prefetcher (void *parm)
{
...
static cSemaphore semFile;
semFile.request();
...
}
Under which scenario this can happen? I replace it with mutex and same issue is happening. Is this some data race condition ?
Aucun commentaire:
Enregistrer un commentaire