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
9fda9767
Commit
9fda9767
authored
Aug 09, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move stuff around
parent
12d0d264
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
55 deletions
+54
-55
include/vlc_threads.h
include/vlc_threads.h
+54
-55
No files found.
include/vlc_threads.h
View file @
9fda9767
...
...
@@ -179,6 +179,15 @@ VLC_EXPORT( void, __vlc_thread_join, ( vlc_object_t *, const char *, int ) );
VLC_EXPORT
(
int
,
vlc_clone
,
(
vlc_thread_t
*
,
void
*
(
*
)
(
void
*
),
void
*
,
int
)
);
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
enum
{
VLC_SAVE_CANCEL
,
VLC_RESTORE_CANCEL
,
VLC_TEST_CANCEL
,
};
#endif
#define vlc_thread_ready vlc_object_signal
...
...
@@ -262,6 +271,51 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
#define vlc_mutex_destroy( P_MUTEX ) \
__vlc_mutex_destroy( __FILE__, __LINE__, P_MUTEX )
/**
* 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
* cancellation-safe.
* @return Previous cancellation state (opaque value).
*/
static
inline
int
vlc_savecancel
(
void
)
{
int
state
;
#if defined (LIBVLC_USE_PTHREAD)
(
void
)
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
state
);
#else
vlc_control_cancel
(
VLC_SAVE_CANCEL
,
&
state
);
#endif
return
state
;
}
/**
* Restore the cancellation state for the calling thread.
* @param state previous state as returned by vlc_savecancel().
* @return Nothing, always succeeds.
*/
static
inline
void
vlc_restorecancel
(
int
state
)
{
#if defined (LIBVLC_USE_PTHREAD)
(
void
)
pthread_setcancelstate
(
state
,
NULL
);
#else
vlc_control_cancel
(
VLC_RESTORE_CANCEL
,
state
);
#endif
}
/**
* Issues an explicit deferred cancellation point.
* This has no effect if thread cancellation is disabled.
* This can be called when there is a rather slow non-sleeping operation.
*/
static
inline
void
vlc_testcancel
(
void
)
{
#if defined (LIBVLC_USE_PTHREAD)
pthread_testcancel
();
#else
vlc_control_cancel
(
VLC_TEST_CANCEL
);
#endif
}
/*****************************************************************************
* vlc_cond_init: initialize a condition
*****************************************************************************/
...
...
@@ -589,61 +643,6 @@ static inline void barrier (void)
#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.
* This function must be called before entering a piece of code that is not
* cancellation-safe.
* @return Previous cancellation state (opaque value).
*/
static
inline
int
vlc_savecancel
(
void
)
{
int
state
;
#if defined (LIBVLC_USE_PTHREAD)
(
void
)
pthread_setcancelstate
(
PTHREAD_CANCEL_DISABLE
,
&
state
);
#else
vlc_control_cancel
(
VLC_SAVE_CANCEL
,
&
state
);
#endif
return
state
;
}
/**
* Restore the cancellation state for the calling thread.
* @param state previous state as returned by vlc_savecancel().
* @return Nothing, always succeeds.
*/
static
inline
void
vlc_restorecancel
(
int
state
)
{
#if defined (LIBVLC_USE_PTHREAD)
(
void
)
pthread_setcancelstate
(
state
,
NULL
);
#else
vlc_control_cancel
(
VLC_RESTORE_CANCEL
,
state
);
#endif
}
/**
* Issues an explicit deferred cancellation point.
* This has no effect if thread cancellation is disabled.
* This can be called when there is a rather slow non-sleeping operation.
*/
static
inline
void
vlc_testcancel
(
void
)
{
#if defined (LIBVLC_USE_PTHREAD)
pthread_testcancel
();
#else
vlc_control_cancel
(
VLC_TEST_CANCEL
);
#endif
}
/*****************************************************************************
* vlc_thread_create: create a thread
*****************************************************************************/
...
...
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