Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
120ad814
Commit
120ad814
authored
Apr 07, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: fix race between vlc_cancel() and vlc_threadvar_set()
parent
e7b765a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
src/win32/thread.c
src/win32/thread.c
+16
-7
No files found.
src/win32/thread.c
View file @
120ad814
...
...
@@ -505,6 +505,7 @@ struct vlc_entry_data
{
void
*
(
*
func
)
(
void
*
);
void
*
data
;
vlc_sem_t
ready
;
#ifdef UNDER_CE
HANDLE
cancel_event
;
#endif
...
...
@@ -512,18 +513,17 @@ struct vlc_entry_data
static
unsigned
__stdcall
vlc_entry
(
void
*
p
)
{
struct
vlc_entry_data
*
entry
=
p
;
vlc_cancel_t
cancel_data
=
VLC_CANCEL_INIT
;
struct
vlc_entry_data
data
;
memcpy
(
&
data
,
p
,
sizeof
(
data
));
free
(
p
);
void
*
(
*
func
)
(
void
*
)
=
entry
->
func
;
void
*
data
=
entry
->
data
;
#ifdef UNDER_CE
cancel_data
.
cancel_event
=
data
.
cancel_event
;
cancel_data
.
cancel_event
=
entry
->
cancel_event
;
#endif
vlc_threadvar_set
(
cancel_key
,
&
cancel_data
);
data
.
func
(
data
.
data
);
vlc_sem_post
(
&
entry
->
ready
);
func
(
data
);
return
0
;
}
...
...
@@ -538,6 +538,7 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
return
ENOMEM
;
entry_data
->
func
=
entry
;
entry_data
->
data
=
data
;
vlc_sem_init
(
&
entry_data
->
ready
,
0
);
#ifndef UNDER_CE
/* When using the MSVCRT C library you have to use the _beginthreadex
...
...
@@ -594,9 +595,17 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
if
(
priority
)
SetThreadPriority
(
hThread
,
priority
);
/* Prevent cancellation until cancel_data is initialized. */
/* XXX: This could be postponed to vlc_cancel() or avoided completely by
* passing the "right" pointer to vlc_cancel_self(). */
vlc_sem_wait
(
&
entry_data
->
ready
);
vlc_sem_destroy
(
&
entry_data
->
ready
);
free
(
entry_data
);
return
0
;
error:
vlc_sem_destroy
(
&
entry_data
->
ready
);
free
(
entry_data
);
return
err
;
}
...
...
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