forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththreads.xml
40 lines (31 loc) · 1.83 KB
/
threads.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<chapter><title>Threading with VLC</title>
<para>VLC is a multi-thread application. We chose against a single-thread
approach because decoder preemptibility and scheduling would be a
mastermind (for instance decoders and outputs have to be separated,
otherwise it cannot be warrantied that a frame will be played at the
exact presentation time), and we currently have no plan to support a
single-threaded client. Multi-process decoders usually imply more overhead
(problems of shared memory) and communication between processes is harder.
</para>
<sect1><title>VLC's threading API</title>
<para>For portability, VLC provides a wrapper for native threading API.
It is modelled on the pthread library.</para>
<para>Our wrapper consists of the following functions:</para>
<itemizedlist>
<listitem><para><function>vlc_thread_create</function></para></listitem>
<listitem><para> <function>vlc_thread_exit</function></para></listitem>
<listitem><para> <function>vlc_thread_join</function></para></listitem>
<listitem><para> <function>vlc_mutex_init</function></para></listitem>
<listitem><para> <function>vlc_mutex_lock</function></para></listitem>
<listitem><para> <function>vlc_mutex_unlock</function></para></listitem>
<listitem><para> <function>vlc_mutex_destroy</function></para></listitem>
<listitem><para> <function>vlc_cond_init</function></para></listitem>
<listitem><para> <function>vlc_cond_signal</function></para></listitem>
<listitem><para> <function>vlc_cond_broadcast</function></para></listitem>
<listitem><para> <function>vlc_cond_wait</function></para></listitem>
<listitem><para> <function>vlc_cond_destroy</function></para></listitem>
</itemizedlist>
<para>Corresponding data structures are <type>vlc_thread_t</type>,
<type>vlc_mutex_t</type>, and <type>vlc_cond_t</type>. </para>
</sect1>
</chapter>