Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
bdfa9d82
Commit
bdfa9d82
authored
Nov 23, 2018
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Use the thread pool for asynchronous tasks.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
79bb84d2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
request.c
dlls/winhttp/request.c
+6
-6
session.c
dlls/winhttp/session.c
+3
-6
winhttp_private.h
dlls/winhttp/winhttp_private.h
+1
-1
No files found.
dlls/winhttp/request.c
View file @
bdfa9d82
...
@@ -191,9 +191,9 @@ static struct task_header *dequeue_task( struct request *request )
...
@@ -191,9 +191,9 @@ static struct task_header *dequeue_task( struct request *request )
return
task
;
return
task
;
}
}
static
DWORD
CALLBACK
task_proc
(
LPVOID
param
)
static
void
CALLBACK
task_proc
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
ctx
)
{
{
struct
request
*
request
=
param
;
struct
request
*
request
=
ctx
;
HANDLE
handles
[
2
];
HANDLE
handles
[
2
];
handles
[
0
]
=
request
->
task_wait
;
handles
[
0
]
=
request
->
task_wait
;
...
@@ -221,21 +221,20 @@ static DWORD CALLBACK task_proc( LPVOID param )
...
@@ -221,21 +221,20 @@ static DWORD CALLBACK task_proc( LPVOID param )
request
->
task_cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
request
->
task_cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
request
->
task_cs
);
DeleteCriticalSection
(
&
request
->
task_cs
);
request
->
hdr
.
vtbl
->
destroy
(
&
request
->
hdr
);
request
->
hdr
.
vtbl
->
destroy
(
&
request
->
hdr
);
return
0
;
return
;
default:
default:
ERR
(
"wait failed %u (%u)
\n
"
,
err
,
GetLastError
());
ERR
(
"wait failed %u (%u)
\n
"
,
err
,
GetLastError
());
break
;
break
;
}
}
}
}
return
0
;
}
}
static
BOOL
queue_task
(
struct
task_header
*
task
)
static
BOOL
queue_task
(
struct
task_header
*
task
)
{
{
struct
request
*
request
=
task
->
request
;
struct
request
*
request
=
task
->
request
;
if
(
!
request
->
task_
thread
)
if
(
!
request
->
task_
wait
)
{
{
if
(
!
(
request
->
task_wait
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
)))
return
FALSE
;
if
(
!
(
request
->
task_wait
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
)))
return
FALSE
;
if
(
!
(
request
->
task_cancel
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
)))
if
(
!
(
request
->
task_cancel
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
)))
...
@@ -244,7 +243,7 @@ static BOOL queue_task( struct task_header *task )
...
@@ -244,7 +243,7 @@ static BOOL queue_task( struct task_header *task )
request
->
task_wait
=
NULL
;
request
->
task_wait
=
NULL
;
return
FALSE
;
return
FALSE
;
}
}
if
(
!
(
request
->
task_thread
=
CreateThread
(
NULL
,
0
,
task_proc
,
request
,
0
,
NULL
)
))
if
(
!
TrySubmitThreadpoolCallback
(
task_proc
,
request
,
NULL
))
{
{
CloseHandle
(
request
->
task_wait
);
CloseHandle
(
request
->
task_wait
);
request
->
task_wait
=
NULL
;
request
->
task_wait
=
NULL
;
...
@@ -252,6 +251,7 @@ static BOOL queue_task( struct task_header *task )
...
@@ -252,6 +251,7 @@ static BOOL queue_task( struct task_header *task )
request
->
task_cancel
=
NULL
;
request
->
task_cancel
=
NULL
;
return
FALSE
;
return
FALSE
;
}
}
request
->
task_proc_running
=
TRUE
;
InitializeCriticalSection
(
&
request
->
task_cs
);
InitializeCriticalSection
(
&
request
->
task_cs
);
request
->
task_cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": request.task_cs"
);
request
->
task_cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": request.task_cs"
);
}
}
...
...
dlls/winhttp/session.c
View file @
bdfa9d82
...
@@ -601,14 +601,11 @@ static void request_destroy( struct object_header *hdr )
...
@@ -601,14 +601,11 @@ static void request_destroy( struct object_header *hdr )
TRACE
(
"%p
\n
"
,
request
);
TRACE
(
"%p
\n
"
,
request
);
if
(
request
->
task_
thread
)
if
(
request
->
task_
proc_running
)
{
{
/* Signal to the task proc to quit. It will call
/* Signal to the task proc to quit. It will call this again when it does. */
this again when it does. */
request
->
task_proc_running
=
FALSE
;
HANDLE
thread
=
request
->
task_thread
;
request
->
task_thread
=
0
;
SetEvent
(
request
->
task_cancel
);
SetEvent
(
request
->
task_cancel
);
CloseHandle
(
thread
);
return
;
return
;
}
}
release_object
(
&
request
->
connect
->
hdr
);
release_object
(
&
request
->
connect
->
hdr
);
...
...
dlls/winhttp/winhttp_private.h
View file @
bdfa9d82
...
@@ -204,7 +204,7 @@ struct request
...
@@ -204,7 +204,7 @@ struct request
struct
authinfo
*
proxy_authinfo
;
struct
authinfo
*
proxy_authinfo
;
HANDLE
task_wait
;
HANDLE
task_wait
;
HANDLE
task_cancel
;
HANDLE
task_cancel
;
HANDLE
task_thread
;
BOOL
task_proc_running
;
struct
list
task_queue
;
struct
list
task_queue
;
CRITICAL_SECTION
task_cs
;
CRITICAL_SECTION
task_cs
;
struct
struct
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment