Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
e3c35026
Commit
e3c35026
authored
Jun 03, 2010
by
Rémi Denis-Courmont
Browse files
vlc_global_mutex: common functions for process-wide mutexes
parent
7c93516a
Changes
3
Hide whitespace changes
Inline
Side-by-side
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
Supports
Markdown
0%
Try again
or
attach a new 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