So i have SEND_SLOT struct:
struct SEND_SLOT
{
SEND_BUFFER buffer;
uint16 index;
CRITICAL_SECTION slotLock;
};
and a connexion struct:
struct connexion
{
...
SEND_SLOT sendSlots[3];
...
}
and in thread A i do:
if(TryEnterCriticalSection(&sendSlots[i]))
{ //Post send request...
WSASend(...);
}
and in thread B i do:
while(...)
{
...
//request finished, data sent, and i get the index to the SEND_SLOT
LeaveCriticalSection(&sendSlots[index]);
...
}
So i'm trying to lock the SEND_SLOT i in thread A and later i want to unlock it, maybe from and other thread, but its not working, each time i try to post new send it locks the first slot even if it hash already been locked and no LeaveCriticalSection has been issued. WHY?
Aucun commentaire:
Enregistrer un commentaire