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
e3c35026
Commit
e3c35026
authored
Jun 03, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_global_mutex: common functions for process-wide mutexes
parent
7c93516a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
include/vlc_threads.h
include/vlc_threads.h
+10
-0
src/libvlccore.sym
src/libvlccore.sym
+1
-0
src/misc/threads.c
src/misc/threads.c
+21
-0
No files found.
include/vlc_threads.h
View file @
e3c35026
...
...
@@ -442,4 +442,14 @@ class vlc_mutex_locker
};
#endif
enum
{
VLC_AVCODEC_MUTEX
=
0
,
VLC_GCRYPT_MUTEX
,
VLC_MAX_MUTEX
};
VLC_EXPORT
(
void
,
vlc_global_mutex
,
(
unsigned
,
bool
)
);
#define vlc_global_lock( n ) vlc_global_mutex( n, true )
#define vlc_global_unlock( n ) vlc_global_mutex( n, false )
#endif
/* !_VLC_THREADS_H */
src/libvlccore.sym
View file @
e3c35026
...
...
@@ -551,6 +551,7 @@ vlc_mutex_init_recursive
vlc_mutex_lock
vlc_mutex_trylock
vlc_mutex_unlock
vlc_global_mutex
vlc_object_attach
vlc_object_create
vlc_object_find
...
...
src/misc/threads.c
View file @
e3c35026
...
...
@@ -233,3 +233,24 @@ void vlc_thread_cancel (vlc_object_t *obj)
if
(
priv
->
b_thread
)
vlc_cancel
(
priv
->
thread_id
);
}
/*** Global locks ***/
void
vlc_global_mutex
(
unsigned
n
,
bool
acquire
)
{
static
vlc_mutex_t
locks
[]
=
{
VLC_STATIC_MUTEX
,
VLC_STATIC_MUTEX
,
};
assert
(
n
<
(
sizeof
(
locks
)
/
sizeof
(
locks
[
0
])));
vlc_mutex_t
*
lock
=
locks
+
n
;
if
(
acquire
)
vlc_mutex_lock
(
lock
);
else
vlc_mutex_unlock
(
lock
);
/* Compile-time assertion ;-) */
char
enough_locks
[(
sizeof
(
locks
)
/
sizeof
(
locks
[
0
]))
-
VLC_MAX_MUTEX
];
(
void
)
enough_locks
;
}
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