Commit 50d9d187 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winhttp: Don't wait for the task thread to exit.

Instead, have the task thread call the destructor before it exits. Previously, if the task thread held the final reference, it would call request_destroy which would then wait for itself to finish.
parent 65319e81
...@@ -217,6 +217,11 @@ static DWORD CALLBACK task_proc( LPVOID param ) ...@@ -217,6 +217,11 @@ static DWORD CALLBACK task_proc( LPVOID param )
} }
case WAIT_OBJECT_0 + 1: case WAIT_OBJECT_0 + 1:
TRACE("exiting\n"); TRACE("exiting\n");
CloseHandle( request->task_cancel );
CloseHandle( request->task_wait );
request->task_cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &request->task_cs );
request->hdr.vtbl->destroy( &request->hdr );
return 0; return 0;
default: default:
......
...@@ -561,13 +561,13 @@ static void request_destroy( object_header_t *hdr ) ...@@ -561,13 +561,13 @@ static void request_destroy( object_header_t *hdr )
if (request->task_thread) if (request->task_thread)
{ {
/* Signal to the task proc to quit. It will call
this again when it does. */
HANDLE thread = request->task_thread;
request->task_thread = 0;
SetEvent( request->task_cancel ); SetEvent( request->task_cancel );
WaitForSingleObject( request->task_thread, INFINITE ); CloseHandle( thread );
CloseHandle( request->task_thread ); return;
CloseHandle( request->task_cancel );
CloseHandle( request->task_wait );
request->task_cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &request->task_cs );
} }
release_object( &request->connect->hdr ); release_object( &request->connect->hdr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment