I/O Completion Port :: GetQueuedCompletionStatus() Problem...



Hi to all "Completion Port Guru's"...

I have Win32 Service which creates a worker thread which calls
GetQueuedCompletionStatus() ...

During unit testing... When GetQueuedCompletionStatus() is blocking
within the worker thread... I manually stop the service which causes
the blocking call to return, I then check the service state and if
"Stopping" then execute a "return(void)" which bounces out of the
thread proc... everything comes down smoothly however I see some
memory leaking via the debugging window... I wondering if it's the
memory from the OVERLAPPED* returned from GetQueueCompletionStatus()
call thats not being "deleted". If I manually try to delete it like:
"delete pOverlapped" it blows chunks! My question are:

1) If a Win32 service is stopped... what is the proper way to exit a
tread blocking on a call to GetQueuedCompletionStatus()?

2) Should you, and if so, how do you delete the OVERLAPPED*
pOverlapped returned by GetQueuedCompletionStatus()
and or cleanup anything else related to the call ?

Thanks in advance !

.