Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
c97e1959
Commit
c97e1959
authored
Dec 05, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: implement cancellation of detached threads
parent
4e647951
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
src/win32/thread.c
src/win32/thread.c
+24
-24
No files found.
src/win32/thread.c
View file @
c97e1959
...
...
@@ -516,7 +516,13 @@ void *vlc_threadvar_get (vlc_threadvar_t key)
return
TlsGetValue
(
key
->
id
);
}
static
void
vlc_threadvar_cleanup
(
void
)
/*** Threads ***/
void
vlc_threads_setup
(
libvlc_int_t
*
p_libvlc
)
{
(
void
)
p_libvlc
;
}
static
void
vlc_thread_cleanup
(
vlc_thread_t
*
th
)
{
vlc_threadvar_t
key
;
...
...
@@ -535,13 +541,15 @@ retry:
}
}
vlc_mutex_unlock
(
&
super_mutex
);
}
/*** Threads ***/
void
vlc_threads_setup
(
libvlc_int_t
*
p_libvlc
)
{
(
void
)
p_libvlc
;
if
(
th
->
detached
)
{
CloseHandle
(
th
->
id
);
#ifdef UNDER_CE
CloseHandle
(
th
->
cancel_event
);
#endif
free
(
th
);
}
}
static
unsigned
__stdcall
vlc_entry
(
void
*
p
)
...
...
@@ -551,9 +559,7 @@ static unsigned __stdcall vlc_entry (void *p)
vlc_threadvar_set
(
thread_key
,
th
);
th
->
killable
=
true
;
th
->
data
=
th
->
entry
(
th
->
data
);
vlc_threadvar_cleanup
();
if
(
th
->
detached
)
free
(
th
);
vlc_thread_exit
(
th
);
return
0
;
}
...
...
@@ -586,7 +592,6 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
}
#else
/* FIXME: cancel_event is useless and leaked in detached threads */
th
->
cancel_event
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
if
(
th
->
cancel_event
==
NULL
)
{
...
...
@@ -606,17 +611,15 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
}
#endif
/* Thread is suspended, so we can safely set th->id */
th
->
id
=
hThread
;
if
(
p_handle
!=
NULL
)
*
p_handle
=
th
;
ResumeThread
(
hThread
);
if
(
priority
)
SetThreadPriority
(
hThread
,
priority
);
if
(
p_handle
!=
NULL
)
*
p_handle
=
th
;
else
CloseHandle
(
hThread
);
return
0
;
}
...
...
@@ -627,12 +630,12 @@ void vlc_join (vlc_thread_t th, void **result)
while
(
WaitForSingleObjectEx
(
th
->
id
,
INFINITE
,
TRUE
)
==
WAIT_IO_COMPLETION
);
if
(
result
!=
NULL
)
*
result
=
th
->
data
;
CloseHandle
(
th
->
id
);
#ifdef UNDER_CE
CloseHandle
(
th
->
cancel_event
);
#endif
if
(
result
!=
NULL
)
*
result
=
th
->
data
;
free
(
th
);
}
...
...
@@ -692,14 +695,11 @@ void vlc_testcancel (void)
if
(
th
->
killable
&&
th
->
killed
)
{
/* Detached threads cannot be cancelled */
assert
(
!
th
->
detached
);
th
->
data
=
NULL
;
/* TODO: special value? */
for
(
vlc_cleanup_t
*
p
=
th
->
cleaners
;
p
!=
NULL
;
p
=
p
->
next
)
p
->
proc
(
p
->
data
);
vlc_threadvar_cleanup
();
th
->
data
=
NULL
;
/* TODO: special value? */
vlc_thread_cleanup
(
th
);
#ifndef UNDER_CE
_endthreadex
(
0
);
#else
...
...
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