Multithreading under NT
Date: 1997/10/28
Message-ID: <634l00$65s_at_sunsystem5.informatik.tu-muenchen.de>#1/1
Hi,
this is my problem:
unsigned long __stdcall Thread(void *)
{
Cda_Def cda;
long value = 1;
memset(&cda, 0, sizeof(cda));
EnterCriticalSection(&cSection);
oopen(&cda, &lda, 0, -1, -1, 0, -1);
oclose(&cda);
LeaveCriticalSection(&cSection);
Sleep(1000);
EnterCriticalSection(&cSection);
LeaveCriticalSection(&cSection);
return 0;
}
this thread hangs if it is spawned twice. The second thread hangs in oopen wich causes the first thread to wait infinitly entering the critical section after the sleeps.
[Quoted] [Quoted] There are three possiblities to make it work:
1. omit the oclose
2. force a thread switch before the oclose (put it into the second critical
section)
[Quoted] 3. omit the opinit(OCI_EV_TSF) at startup.
It seems that oopen waits infinitly calling WaitForSingleObject, but i'm not shure.
Any suggestions ?
Ingo Eichenseher
Lehrstuhl fuer Angewandte Mathematik
Technische Universitaet Muenchen
www.appl-math.tu-muenchen.de/~ieichens
Received on Tue Oct 28 1997 - 00:00:00 CET