Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
bafe9aa0
Commit
bafe9aa0
authored
Jan 21, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add inline API for spinlocks.
parent
ae71e21f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
include/vlc_threads_funcs.h
include/vlc_threads_funcs.h
+46
-0
No files found.
include/vlc_threads_funcs.h
View file @
bafe9aa0
...
@@ -802,6 +802,52 @@ static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
...
@@ -802,6 +802,52 @@ static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
return
p_ret
;
return
p_ret
;
}
}
# if defined (_POSIX_SPIN_LOCKS) && ((_POSIX_SPIN_LOCKS - 0) > 0)
typedef
struct
{
pthread_spinlock_t
spin
;
}
vlc_spinlock_t
;
/**
* Initializes a spinlock.
*/
static
inline
int
vlc_spin_init
(
vlc_spinlock_t
*
spin
)
{
return
pthread_spin_init
(
&
spin
,
PTHREAD_PROCESS_PRIVATE
);
}
/**
* Acquires a spinlock.
*/
static
inline
int
vlc_spin_lock
(
vlc_spinlock_t
*
spin
)
{
return
pthread_spin_lock
(
&
spin
->
spin
);
}
/**
* Releases a spinlock.
*/
static
inline
int
vlc_spin_unlock
(
vlc_spinlock_t
*
spin
)
{
return
pthread_spin_unlock
(
&
spin
->
spin
);
}
/**
* Deinitializes a spinlock.
*/
static
inline
int
vlc_spin_destroy
(
vlc_spinlock_t
*
spin
)
{
return
pthread_spin_destroy
(
&
spin
->
spin
);
}
#else
/* Fallback to plain mutexes if spinlocks are not available */
typedef
vlc_mutex_t
vlc_spinlock_t
;
# define vlc_spin_init vlc_mutex_init
# define vlc_spin_lock vlc_mutex_lock
# define vlc_spin_unlock vlc_mutex_unlock
# define vlc_spin_destroy vlc_mutex_destroy
#endif
/*****************************************************************************
/*****************************************************************************
* vlc_thread_create: create a thread
* 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