Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
5a631288
Commit
5a631288
authored
Jul 12, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stub cancellation support
parent
fb157491
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
0 deletions
+60
-0
include/vlc_threads.h
include/vlc_threads.h
+16
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/misc/threads.c
src/misc/threads.c
+43
-0
No files found.
include/vlc_threads.h
View file @
5a631288
...
@@ -589,6 +589,16 @@ static inline void barrier (void)
...
@@ -589,6 +589,16 @@ static inline void barrier (void)
#endif
#endif
}
}
#ifndef LIBVLC_USE_PTHREAD
enum
{
VLC_SAVE_CANCEL
,
VLC_RESTORE_CANCEL
,
VLC_TEST_CANCEL
,
};
#endif
VLC_EXPORT
(
void
,
vlc_control_cancel
,
(
int
cmd
,
...));
/**
/**
* Save the cancellation state and disable cancellation for the calling thread.
* Save the cancellation state and disable cancellation for the calling thread.
* This function must be called before entering a piece of code that is not
* This function must be called before entering a piece of code that is not
...
@@ -600,6 +610,8 @@ static inline void vlc_savecancel (int *p_state)
...
@@ -600,6 +610,8 @@ static inline void vlc_savecancel (int *p_state)
{
{
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD)
(
void
)
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
p_state
);
(
void
)
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
p_state
);
#else
vlc_control_cancel
(
VLC_SAVE_CANCEL
,
p_state
);
#endif
#endif
}
}
...
@@ -612,6 +624,8 @@ static inline void vlc_restorecancel (int state)
...
@@ -612,6 +624,8 @@ static inline void vlc_restorecancel (int state)
{
{
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD)
(
void
)
pthread_setcancelstate
(
state
,
NULL
);
(
void
)
pthread_setcancelstate
(
state
,
NULL
);
#else
vlc_control_cancel
(
VLC_RESTORE_CANCEL
,
state
);
#endif
#endif
}
}
...
@@ -624,6 +638,8 @@ static inline void vlc_testcancel (void)
...
@@ -624,6 +638,8 @@ static inline void vlc_testcancel (void)
{
{
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD)
pthread_testcancel
();
pthread_testcancel
();
#else
vlc_control_cancel
(
VLC_TEST_CANCEL
);
#endif
#endif
}
}
...
...
src/libvlccore.sym
View file @
5a631288
...
@@ -426,6 +426,7 @@ __vlc_cond_destroy
...
@@ -426,6 +426,7 @@ __vlc_cond_destroy
__vlc_cond_init
__vlc_cond_init
vlc_config_create
vlc_config_create
vlc_config_set
vlc_config_set
vlc_control_cancel
vlc_CPU
vlc_CPU
vlc_error
vlc_error
__vlc_event_attach
__vlc_event_attach
...
...
src/misc/threads.c
View file @
5a631288
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include "libvlc.h"
#include "libvlc.h"
#include <stdarg.h>
#include <assert.h>
#include <assert.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
# include <unistd.h>
...
@@ -836,3 +837,45 @@ void vlc_thread_cancel (vlc_object_t *obj)
...
@@ -836,3 +837,45 @@ void vlc_thread_cancel (vlc_object_t *obj)
if
(
priv
->
b_thread
)
if
(
priv
->
b_thread
)
vlc_cancel
(
priv
->
thread_id
);
vlc_cancel
(
priv
->
thread_id
);
}
}
void
vlc_control_cancel
(
int
cmd
,
...)
{
#ifdef LIBVLC_USE_PTHREAD
(
void
)
cmd
;
abort
();
#else
static
__thread
struct
vlc_cancel_t
*
stack
=
NULL
;
static
__thread
bool
killed
=
false
,
killable
=
true
;
va_list
ap
;
va_start
(
ap
,
cmd
);
switch
(
cmd
)
{
case
VLC_SAVE_CANCEL
:
{
int
*
p_state
=
va_arg
(
ap
,
int
*
);
*
p_state
=
killable
;
killable
=
false
;
break
;
}
case
VLC_RESTORE_CANCEL
:
{
int
state
=
va_arg
(
ap
,
int
);
killable
=
state
!=
0
;
break
;
}
case
VLC_TEST_CANCEL
:
if
(
killable
)
#ifdef WIN32
_endthread
();
#else
# error Not implemented!
#endif
break
;
}
va_end
(
ap
);
#endif
}
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