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
0bdeef7e
Commit
0bdeef7e
authored
Aug 16, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: allocate cancellation data on the stack (cannot fail)
Better than an unlikely abort().
parent
0a908c0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
src/misc/threads.c
src/misc/threads.c
+21
-12
No files found.
src/misc/threads.c
View file @
0bdeef7e
...
...
@@ -148,6 +148,20 @@ void vlc_pthread_fatal (const char *action, int error,
static
vlc_threadvar_t
cancel_key
;
#endif
/**
* Per-thread cancellation data
*/
#ifndef LIBVLC_USE_PTHREAD_CANCEL
typedef
struct
vlc_cancel_t
{
vlc_cleanup_t
*
cleaners
;
bool
killable
;
bool
killed
;
}
vlc_cancel_t
;
# define VLC_CANCEL_INIT { NULL, false, true }
#endif
/*****************************************************************************
* vlc_threads_init: initialize threads system
*****************************************************************************
...
...
@@ -451,7 +465,10 @@ void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
#elif defined (WIN32)
static
unsigned
__stdcall
vlc_entry
(
void
*
data
)
{
vlc_cancel_t
cancel_data
=
VLC_CANCEL_INIT
;
vlc_thread_t
self
=
data
;
vlc_threadvar_set
(
&
cancel_key
,
&
cancel_data
);
self
->
data
=
self
->
entry
(
self
->
data
);
return
0
;
}
...
...
@@ -866,15 +883,6 @@ void vlc_thread_cancel (vlc_object_t *obj)
vlc_cancel
(
priv
->
thread_id
);
}
#ifndef LIBVLC_USE_PTHREAD_CANCEL
typedef
struct
vlc_cancel_t
{
vlc_cleanup_t
*
cleaners
;
bool
killable
;
bool
killed
;
}
vlc_cancel_t
;
#endif
void
vlc_control_cancel
(
int
cmd
,
...)
{
/* NOTE: This function only modifies thread-specific data, so there is no
...
...
@@ -888,15 +896,16 @@ void vlc_control_cancel (int cmd, ...)
va_start
(
ap
,
cmd
);
vlc_cancel_t
*
nfo
=
vlc_threadvar_get
(
&
cancel_key
);
#ifndef WIN32
if
(
nfo
==
NULL
)
{
nfo
=
malloc
(
sizeof
(
*
nfo
));
if
(
nfo
==
NULL
)
abort
();
nfo
->
cleaners
=
NULL
;
nfo
->
killed
=
false
;
nfo
->
killable
=
true
;
*
nfo
=
VLC_CANCEL_INIT
;
vlc_threadvar_set
(
&
cancel_key
,
nfo
);
}
#endif
switch
(
cmd
)
{
...
...
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