Add GAppInfoMonitor
[platform/upstream/glib.git] / docs / reference / glib / programming.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3                "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 ]>
5 <refentry id="glib-programming">
6 <refmeta>
7 <refentrytitle>Writing GLib Applications</refentrytitle>
8 <manvolnum>3</manvolnum>
9 <refmiscinfo>GLib Library</refmiscinfo>
10 </refmeta>
11
12 <refnamediv>
13 <refname>Writing GLib Applications</refname>
14 <refpurpose>
15 General considerations when programming with GLib
16 </refpurpose>
17 </refnamediv>
18
19 <refsect1>
20 <title>Writing GLib Applications</title>
21
22 <refsect2>
23 <title>Threads</title>
24
25 <para>
26 The general policy of GLib is that all functions are invisibly threadsafe
27 with the exception of data structure manipulation functions, where, if
28 you have two threads manipulating the <emphasis>same</emphasis> data
29 structure, they must use a lock to synchronize their operation.
30 </para>
31
32 <para>
33 GLib is creating a worker thread for its own purposes, so GLib applications
34 will always have at least 2 threads.
35 </para>
36
37 <para>
38 See the sections on <link linkend="glib-Threads">threads</link> and
39 <link linkend="glib-Thread-Pools">threadpools</link> for GLib APIs that
40 support multithreaded applications.
41 </para>
42
43 </refsect2>
44
45 <refsect2>
46 <title>Security</title>
47
48 <para>
49 When writing code that runs with elevated privileges, it is important
50 to follow some basic rules of secure programming. David Wheeler has an
51 excellent book on this topic,
52 <ulink url="http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/index.html">Secure Programming for Linux and Unix HOWTO</ulink>.
53 </para>
54
55 <para>
56 When it comes to GLib and its associated libraries, GLib and
57 GObject are generally fine to use in code that runs with elevated
58 privileges; they don't load modules (executable code in shared objects)
59 or run other programs 'behind your back'. GIO has to be used
60 carefully in privileged programs, see the <ulink url="http://developer.gnome.org/gio/stable/ch02.html">GIO documentation</ulink> for details.
61 </para>
62
63 </refsect2>
64
65 </refsect1>
66
67 </refentry>