Skip to content

Commit

Permalink
Closing Handlers explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Nov 23, 2021
1 parent b16b6da commit 6e541fb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions extracted/vm/src/win/aioWin.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ EXPORT(long) aioPoll(long microSeconds){
waitingHandles[i] = sliceWaitForMultipleObjects(allHandles, initialIndex, sizeToProcess, microSeconds);

if(waitingHandles[i] == NULL){

for(int j=1; j < i; j++){
CloseHandle(waitingHandles[j]);
}

free(waitingHandles);
free(allHandles);

Expand All @@ -489,6 +494,15 @@ EXPORT(long) aioPoll(long microSeconds){

returnValue = WaitForMultipleObjectsEx(numberOfThreads + 1, waitingHandles, FALSE, microSeconds / 1000, FALSE);

/*
* Closing handles
*/

for(int i=1; i <= numberOfThreads; i++){
CloseHandle(waitingHandles[i]);
}


if(returnValue == WAIT_TIMEOUT){
heartbeat_poll_exit(microSeconds);

Expand Down

0 comments on commit 6e541fb

Please sign in to comment.