PLEASE FORGET THIS POST...
The problem was located in the debugger, which is not able to handle several running threads of ThRead().
I wrote a file-buffer using Borland C++ 4.x.
The buffer is implemented as a thread, which fills itself automatically.
I implemented a function, called GetChar() which returns the very first char from the buffer and shifts the allocated char-array. It also uses a critical section to avoid reading and writing simultaniously from/into the buffer.
csAccess = TCriticalSection()-Object
szBuffer[] was made as char *szBuffer = (char*)malloc( BUFFSIZE );
iBufferFillState contains the number of bytes in the buffer. It's set by the reading loop.char __fastcall ThRead::GetChar() { char cReturn; int iWalk; csAccess->Enter(); //Store the return value cReturn = szBuffer[0]; //shift the array for ( iWalk = 0; iWalk < iBufferFillState - 1;iWalk++) { szBuffer[iWalk] = szBuffer[iWalk+1]; } iBufferFillState --; csAccess->Leave(); return cReturn; }
The Problem:
The programm gets stuck when arriving here.
for ( iWalk = 0; iWalk < iBufferFillState - 1;iWalk++) { szBuffer[iWalk] = szBuffer[iWalk+1]; }
I don't know why!?! As you can see, there should no conflict happen. The part of the reading loop, which fills the buffer is also protected thru the SAME csAccess-Object.
And hints?
Andi
PS: This also happens, if I use an unallocated int[]. So, the main question is: Am I to stupid to shift an array? :-|