Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
0a908c0b
Commit
0a908c0b
authored
Aug 16, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Potentially) allow pthread without pthread native cancellation
parent
dde85414
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
include/vlc_threads.h
include/vlc_threads.h
+7
-6
src/misc/threads.c
src/misc/threads.c
+6
-4
No files found.
include/vlc_threads.h
View file @
0a908c0b
...
...
@@ -47,6 +47,7 @@
#else
/* pthreads (like Linux & BSD) */
# define LIBVLC_USE_PTHREAD 1
# define LIBVLC_USE_PTHREAD_CANCEL 1
# define _APPLE_C_SOURCE 1
/* Proper pthread semantics on OSX */
# include <stdlib.h>
/* lldiv_t definition (only in C99) */
...
...
@@ -181,7 +182,7 @@ VLC_EXPORT( void, vlc_cancel, (vlc_thread_t) );
VLC_EXPORT
(
int
,
vlc_join
,
(
vlc_thread_t
,
void
**
)
);
VLC_EXPORT
(
void
,
vlc_control_cancel
,
(
int
cmd
,
...));
#ifndef LIBVLC_USE_PTHREAD
#ifndef LIBVLC_USE_PTHREAD
_CANCEL
enum
{
VLC_SAVE_CANCEL
,
VLC_RESTORE_CANCEL
,
...
...
@@ -283,7 +284,7 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
static
inline
int
vlc_savecancel
(
void
)
{
int
state
;
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD
_CANCEL
)
(
void
)
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
state
);
#else
vlc_control_cancel
(
VLC_SAVE_CANCEL
,
&
state
);
...
...
@@ -298,7 +299,7 @@ static inline int vlc_savecancel (void)
*/
static
inline
void
vlc_restorecancel
(
int
state
)
{
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD
_CANCEL
)
(
void
)
pthread_setcancelstate
(
state
,
NULL
);
#else
vlc_control_cancel
(
VLC_RESTORE_CANCEL
,
state
);
...
...
@@ -312,14 +313,14 @@ static inline void vlc_restorecancel (int state)
*/
static
inline
void
vlc_testcancel
(
void
)
{
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD
_CANCEL
)
pthread_testcancel
();
#else
vlc_control_cancel
(
VLC_TEST_CANCEL
);
#endif
}
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD
_CANCEL
)
/**
* Registers a new procedure to run if the thread is cancelled (or otherwise
* exits prematurely). Any call to vlc_cleanup_push() <b>must</b> paired with a
...
...
@@ -371,7 +372,7 @@ struct vlc_cleanup_t
vlc_cleanup_data.proc (vlc_cleanup_data.data); \
} while (0)
#endif
/* LIBVLC_USE_PTHREAD */
#endif
/* LIBVLC_USE_PTHREAD
_CANCEL
*/
static
inline
void
vlc_cleanup_lock
(
void
*
lock
)
{
...
...
src/misc/threads.c
View file @
0a908c0b
...
...
@@ -180,7 +180,7 @@ int vlc_threads_init( void )
vlc_threadvar_create
(
&
thread_object_key
,
NULL
);
#endif
vlc_threadvar_create
(
&
msg_context_global_key
,
msg_StackDestroy
);
#ifndef LIBVLC_USE_PTHREAD
#ifndef LIBVLC_USE_PTHREAD
_CANCEL
vlc_threadvar_create
(
&
cancel_key
,
free
);
#endif
}
...
...
@@ -586,10 +586,12 @@ static void CALLBACK vlc_cancel_self (ULONG_PTR dummy)
*/
void
vlc_cancel
(
vlc_thread_t
thread_id
)
{
#if defined (LIBVLC_USE_PTHREAD)
#if defined (LIBVLC_USE_PTHREAD
_CANCEL
)
pthread_cancel
(
thread_id
);
#elif defined (WIN32)
QueueUserAPC
(
vlc_cancel_self
,
thread_id
->
handle
,
0
);
#else
# warning vlc_cancel is not implemented!
#endif
}
...
...
@@ -864,7 +866,7 @@ void vlc_thread_cancel (vlc_object_t *obj)
vlc_cancel
(
priv
->
thread_id
);
}
#ifndef LIBVLC_USE_PTHREAD
#ifndef LIBVLC_USE_PTHREAD
_CANCEL
typedef
struct
vlc_cancel_t
{
vlc_cleanup_t
*
cleaners
;
...
...
@@ -877,7 +879,7 @@ void vlc_control_cancel (int cmd, ...)
{
/* NOTE: This function only modifies thread-specific data, so there is no
* need to lock anything. */
#ifdef LIBVLC_USE_PTHREAD
#ifdef LIBVLC_USE_PTHREAD
_CANCEL
(
void
)
cmd
;
assert
(
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