Hi all,
I have a problem with CriticalSection / InterlockIncrement / Decrement on
WinXP (sorry for bother but maybe it is also important for us):
In my program I work with around 200 threads which access a list of objects
(pointer). Between the Enter and Leave the Threads delete or add an object.
Sometimes it take more than 5 seconds to enter the critical section (every
thread need for the operation around 5 ms (5 * 200 = 1000 ms -> 1 second)) I
also see that the Enter has taken 10 seconds ...
There is no load on that system (around 10 %).
After playing around with InterlockIncrement and ILDec I have implemented
it in asm:
int MyLockInc(volatile long *lCount)
{
//variables
///////////
int nRes = 0;
__asm
{
mov ecx, lCount;
mov eax, 1;
lock xadd [ECX], EAX;
inc EAX;
mov nRes, EAX;
};
return nRes;
};
int MyLockDec(volatile long *lCount)
{
//variables
///////////
int nRes = 0;
__asm
{
mov ecx, lCount;
mov eax, -1;
lock xadd [ECX], EAX;
dec eax;
mov nRes, EAX;
};
return nRes;
};
But it is the same !!!!
What can I do ?
My problem is, that if I need more than 3 seconds for
This operation (which should be more than enough) the
Operation will be done again (by an external tool)
which creates ++ new Requests for each one which has
failed (not just in time)...
You can imagine what will happen after 10 failed requests...
I cant change the behaviour of the other program ...
Please help I play around on this stupid problem since
5 month ...
Kind regards
Christian