Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
84660d52
Commit
84660d52
authored
Nov 23, 2023
by
Alfred Agrell
Committed by
Alexandre Julliard
Dec 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Introduce mutex for wm_reader read_thread_shutdown.
parent
1cc29f96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
wm_reader.c
dlls/winegstreamer/wm_reader.c
+19
-1
No files found.
dlls/winegstreamer/wm_reader.c
View file @
84660d52
...
@@ -54,6 +54,7 @@ struct wm_reader
...
@@ -54,6 +54,7 @@ struct wm_reader
LONG
refcount
;
LONG
refcount
;
CRITICAL_SECTION
cs
;
CRITICAL_SECTION
cs
;
CRITICAL_SECTION
shutdown_cs
;
QWORD
start_time
;
QWORD
start_time
;
QWORD
file_size
;
QWORD
file_size
;
...
@@ -601,7 +602,7 @@ static DWORD CALLBACK read_thread(void *arg)
...
@@ -601,7 +602,7 @@ static DWORD CALLBACK read_thread(void *arg)
TRACE
(
"Starting read thread for reader %p.
\n
"
,
reader
);
TRACE
(
"Starting read thread for reader %p.
\n
"
,
reader
);
while
(
!
reader
->
read_thread_shutdown
)
while
(
true
)
{
{
LARGE_INTEGER
large_offset
;
LARGE_INTEGER
large_offset
;
uint64_t
offset
;
uint64_t
offset
;
...
@@ -609,6 +610,14 @@ static DWORD CALLBACK read_thread(void *arg)
...
@@ -609,6 +610,14 @@ static DWORD CALLBACK read_thread(void *arg)
uint32_t
size
;
uint32_t
size
;
HRESULT
hr
;
HRESULT
hr
;
EnterCriticalSection
(
&
reader
->
shutdown_cs
);
if
(
reader
->
read_thread_shutdown
)
{
LeaveCriticalSection
(
&
reader
->
shutdown_cs
);
break
;
}
LeaveCriticalSection
(
&
reader
->
shutdown_cs
);
if
(
!
wg_parser_get_next_read_offset
(
reader
->
wg_parser
,
&
offset
,
&
size
))
if
(
!
wg_parser_get_next_read_offset
(
reader
->
wg_parser
,
&
offset
,
&
size
))
continue
;
continue
;
...
@@ -1450,6 +1459,7 @@ static HRESULT init_stream(struct wm_reader *reader)
...
@@ -1450,6 +1459,7 @@ static HRESULT init_stream(struct wm_reader *reader)
reader
->
wg_parser
=
wg_parser
;
reader
->
wg_parser
=
wg_parser
;
reader
->
read_thread_shutdown
=
false
;
reader
->
read_thread_shutdown
=
false
;
if
(
!
(
reader
->
read_thread
=
CreateThread
(
NULL
,
0
,
read_thread
,
reader
,
0
,
NULL
)))
if
(
!
(
reader
->
read_thread
=
CreateThread
(
NULL
,
0
,
read_thread
,
reader
,
0
,
NULL
)))
{
{
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
...
@@ -1517,7 +1527,9 @@ out_disconnect_parser:
...
@@ -1517,7 +1527,9 @@ out_disconnect_parser:
wg_parser_disconnect
(
reader
->
wg_parser
);
wg_parser_disconnect
(
reader
->
wg_parser
);
out_shutdown_thread:
out_shutdown_thread:
EnterCriticalSection
(
&
reader
->
shutdown_cs
);
reader
->
read_thread_shutdown
=
true
;
reader
->
read_thread_shutdown
=
true
;
LeaveCriticalSection
(
&
reader
->
shutdown_cs
);
WaitForSingleObject
(
reader
->
read_thread
,
INFINITE
);
WaitForSingleObject
(
reader
->
read_thread
,
INFINITE
);
CloseHandle
(
reader
->
read_thread
);
CloseHandle
(
reader
->
read_thread
);
reader
->
read_thread
=
NULL
;
reader
->
read_thread
=
NULL
;
...
@@ -1728,6 +1740,8 @@ static ULONG WINAPI unknown_inner_Release(IUnknown *iface)
...
@@ -1728,6 +1740,8 @@ static ULONG WINAPI unknown_inner_Release(IUnknown *iface)
reader
->
cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
reader
->
cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
reader
->
cs
);
DeleteCriticalSection
(
&
reader
->
cs
);
reader
->
shutdown_cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
reader
->
shutdown_cs
);
free
(
reader
);
free
(
reader
);
}
}
...
@@ -1781,7 +1795,9 @@ static HRESULT WINAPI reader_Close(IWMSyncReader2 *iface)
...
@@ -1781,7 +1795,9 @@ static HRESULT WINAPI reader_Close(IWMSyncReader2 *iface)
wg_parser_disconnect
(
reader
->
wg_parser
);
wg_parser_disconnect
(
reader
->
wg_parser
);
EnterCriticalSection
(
&
reader
->
shutdown_cs
);
reader
->
read_thread_shutdown
=
true
;
reader
->
read_thread_shutdown
=
true
;
LeaveCriticalSection
(
&
reader
->
shutdown_cs
);
WaitForSingleObject
(
reader
->
read_thread
,
INFINITE
);
WaitForSingleObject
(
reader
->
read_thread
,
INFINITE
);
CloseHandle
(
reader
->
read_thread
);
CloseHandle
(
reader
->
read_thread
);
reader
->
read_thread
=
NULL
;
reader
->
read_thread
=
NULL
;
...
@@ -2557,6 +2573,8 @@ HRESULT WINAPI winegstreamer_create_wm_sync_reader(IUnknown *outer, void **out)
...
@@ -2557,6 +2573,8 @@ HRESULT WINAPI winegstreamer_create_wm_sync_reader(IUnknown *outer, void **out)
InitializeCriticalSection
(
&
object
->
cs
);
InitializeCriticalSection
(
&
object
->
cs
);
object
->
cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": reader.cs"
);
object
->
cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": reader.cs"
);
InitializeCriticalSection
(
&
object
->
shutdown_cs
);
object
->
shutdown_cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": reader.shutdown_cs"
);
TRACE
(
"Created reader %p.
\n
"
,
object
);
TRACE
(
"Created reader %p.
\n
"
,
object
);
*
out
=
outer
?
(
void
*
)
&
object
->
IUnknown_inner
:
(
void
*
)
&
object
->
IWMSyncReader2_iface
;
*
out
=
outer
?
(
void
*
)
&
object
->
IUnknown_inner
:
(
void
*
)
&
object
->
IWMSyncReader2_iface
;
...
...
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