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
fa9bbe8a
Commit
fa9bbe8a
authored
Jul 28, 2021
by
Paul Gofman
Committed by
Alexandre Julliard
Jul 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Only queue IO callback if IO is pending in ioqueue_thread_proc().
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
217ae19d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
threadpool.c
dlls/ntdll/tests/threadpool.c
+18
-0
threadpool.c
dlls/ntdll/threadpool.c
+17
-12
No files found.
dlls/ntdll/tests/threadpool.c
View file @
fa9bbe8a
...
...
@@ -2139,6 +2139,24 @@ static void test_tp_io(void)
ok
(
!
userdata
.
length
,
"got length %lu
\n
"
,
userdata
.
length
);
ok
(
userdata
.
io
==
io
,
"expected %p, got %p
\n
"
,
io
,
userdata
.
io
);
userdata
.
count
=
0
;
pTpStartAsyncIoOperation
(
io
);
pTpCancelAsyncIoOperation
(
io
);
ret
=
ReadFile
(
server
,
in
,
sizeof
(
in
),
NULL
,
&
ovl
);
ok
(
!
ret
,
"wrong ret %d
\n
"
,
ret
);
ret
=
WriteFile
(
client
,
out
,
sizeof
(
out
),
&
ret_size
,
NULL
);
ok
(
ret
,
"WriteFile() failed, error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_IO_PENDING
,
"wrong error %u
\n
"
,
GetLastError
());
pTpWaitForIoCompletion
(
io
,
FALSE
);
if
(
0
)
{
/* Add a sleep to check that callback is not called later. Commented out to
* save the test time. */
Sleep
(
200
);
}
ok
(
userdata
.
count
==
0
,
"callback ran %u times
\n
"
,
userdata
.
count
);
CloseHandle
(
ovl
.
hEvent
);
CloseHandle
(
client
);
CloseHandle
(
server
);
...
...
dlls/ntdll/threadpool.c
View file @
fa9bbe8a
...
...
@@ -1536,22 +1536,25 @@ static void CALLBACK ioqueue_thread_proc( void *param )
{
RtlEnterCriticalSection
(
&
io
->
pool
->
cs
);
--
io
->
u
.
io
.
pending_count
;
TRACE
(
"pending_count %u.
\n
"
,
io
->
u
.
io
.
pending_count
)
;
if
(
!
array_reserve
((
void
**
)
&
io
->
u
.
io
.
completions
,
&
io
->
u
.
io
.
completion_max
,
io
->
u
.
io
.
completion_count
+
1
,
sizeof
(
*
io
->
u
.
io
.
completions
)))
if
(
io
->
u
.
io
.
pending_count
)
{
ERR
(
"Failed to allocate memory.
\n
"
)
;
RtlLeaveCriticalSection
(
&
io
->
pool
->
cs
);
continue
;
}
completion
=
&
io
->
u
.
io
.
completions
[
io
->
u
.
io
.
completion_count
++
]
;
completion
->
iosb
=
iosb
;
completion
->
cvalue
=
value
;
--
io
->
u
.
io
.
pending_count
;
if
(
!
array_reserve
((
void
**
)
&
io
->
u
.
io
.
completions
,
&
io
->
u
.
io
.
completion_max
,
io
->
u
.
io
.
completion_count
+
1
,
sizeof
(
*
io
->
u
.
io
.
completions
)))
{
ERR
(
"Failed to allocate memory.
\n
"
);
RtlLeaveCriticalSection
(
&
io
->
pool
->
cs
)
;
continue
;
}
tp_object_submit
(
io
,
FALSE
);
completion
=
&
io
->
u
.
io
.
completions
[
io
->
u
.
io
.
completion_count
++
];
completion
->
iosb
=
iosb
;
completion
->
cvalue
=
value
;
tp_object_submit
(
io
,
FALSE
);
}
RtlLeaveCriticalSection
(
&
io
->
pool
->
cs
);
}
...
...
@@ -2525,6 +2528,8 @@ void WINAPI TpCancelAsyncIoOperation( TP_IO *io )
RtlEnterCriticalSection
(
&
this
->
pool
->
cs
);
TRACE
(
"pending_count %u.
\n
"
,
this
->
u
.
io
.
pending_count
);
this
->
u
.
io
.
pending_count
--
;
if
(
object_is_finished
(
this
,
TRUE
))
RtlWakeAllConditionVariable
(
&
this
->
group_finished_event
);
...
...
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