VLC 4.0.0-dev
Loading...
Searching...
No Matches
LibVLC media player concurrency API
Collaboration diagram for LibVLC media player concurrency API:

Functions

LIBVLC_API void libvlc_media_player_lock (libvlc_media_player_t *mp)
 Lock the media_player internal lock.
 
LIBVLC_API void libvlc_media_player_unlock (libvlc_media_player_t *mp)
 Unlock the media_player internal lock.
 
LIBVLC_API void libvlc_media_player_wait (libvlc_media_player_t *mp)
 Wait for an event to be signalled.
 
LIBVLC_API void libvlc_media_player_signal (libvlc_media_player_t *mp)
 Signal all threads waiting for a signalling event.
 

Detailed Description

Function Documentation

◆ libvlc_media_player_lock()

LIBVLC_API void libvlc_media_player_lock ( libvlc_media_player_t mp)

Lock the media_player internal lock.

The lock is recursive, so it's safe to use it multiple times from the same thread. You must call libvlc_media_player_unlock() the same number of times you called libvlc_media_player_lock().

Locking is not mandatory before calling a libvlc_media_player_t function since they will automatically hold the lock internally.

This lock can be used to synchronise user variables that interact with the libvlc_media_player_t or can be used to call several functions together.

Parameters
mpmedia player object
Version
LibVLC 4.0.0 or later

◆ libvlc_media_player_signal()

LIBVLC_API void libvlc_media_player_signal ( libvlc_media_player_t mp)

Signal all threads waiting for a signalling event.

Note
this is equivalent to pthread_cond_broadcast() with the libvlc_media_player_t internal condition variable.
Parameters
mpmedia player object locked using /ref libvlc_media_player_lock
Version
LibVLC 4.0.0 or later

◆ libvlc_media_player_unlock()

LIBVLC_API void libvlc_media_player_unlock ( libvlc_media_player_t mp)

Unlock the media_player internal lock.

See also
libvlc_media_player_lock
Parameters
mpmedia player object locked using /ref libvlc_media_player_lock
Version
LibVLC 4.0.0 or later

◆ libvlc_media_player_wait()

LIBVLC_API void libvlc_media_player_wait ( libvlc_media_player_t mp)

Wait for an event to be signalled.

Note
this is equivalent to pthread_cond_wait() with the libvlc_media_player_t internal mutex and condition variable. This function may spuriously wake up even without libvlc_media_player_signal() being called.
Warning
this function must not be called from any libvlc callbacks and events. The lock should be held only one time before waiting.
Parameters
mpmedia player object locked using /ref libvlc_media_player_lock
Version
LibVLC 4.0.0 or later