summaryrefslogtreecommitdiff
path: root/documentation/advanced.dox
diff options
context:
space:
mode:
authorengelsman <engelsman>2008-10-11 08:14:59 +0000
committerengelsman <engelsman>2008-10-11 08:14:59 +0000
commit0e518f7f49011ab5a3aad9ed9ccd271961ecc566 (patch)
treeaf7c8a8bd718511acad57fbaa9215b72eafe0d35 /documentation/advanced.dox
parentd658ae60392ed57eedd3ada08717e4947768934e (diff)
more html to doxygen conversion for {fluid,advanced,unicode}.dox
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6407 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'documentation/advanced.dox')
-rw-r--r--documentation/advanced.dox87
1 files changed, 52 insertions, 35 deletions
diff --git a/documentation/advanced.dox b/documentation/advanced.dox
index 5f084c2c7..fbc9d5f0c 100644
--- a/documentation/advanced.dox
+++ b/documentation/advanced.dox
@@ -2,18 +2,35 @@
\page advanced 10 - Advanced FLTK
-<P>This chapter explains advanced programming and design topics
-that will help you to get the most out of FLTK.</P>
-
-<H2><A NAME="multithreading">Multithreading</H2>
-
-<P>FLTK supports multithreaded application using a locking mechanism based on "pthreads". We do not provide a threading interface as part of the library. However a simple example how threads can be implemented for all supported platforms can be found in <tt>test/threads.h</tt> and <tt>test/threads.cxx</tt>.
-
-<P>To use the locking mechanism, FLTK must be compiled with <tt>--enable-threads</tt> set during the <tt>configure</tt> process. IDE-based versions of FLTK are automatically compiled with locking enabled if possible.
-
-<P>In <TT>main()</TT>, call <a href="Fl.html#Fl.lock"><TT>Fl::lock()</TT></A> before <A HREF="Fl.html#Fl.run"><TT>Fl::run()</TT></A> or <A HREF="Fl.html#Fl.wait"><TT>Fl::wait()</TT></A> to start the runtime multithreading support for your program. All callbacks and derived functions like <tt>handle()</tt> and <tt>draw()</tt> will now be properly locked:</P>
-
-<pre>
+This chapter explains advanced programming and design topics
+that will help you to get the most out of FLTK.
+
+<A NAME="multithreading"> </A> <!-- For old HTML links only ! -->
+\section advanced_multithreading Multithreading
+
+FLTK supports multithreaded application using a locking mechanism
+based on "pthreads". We do not provide a threading interface as part of
+the library. However a simple example how threads can be implemented
+for all supported platforms can be found in <tt>test/threads.h</tt>
+and <tt>test/threads.cxx</tt>.
+
+To use the locking mechanism, FLTK must be compiled with
+<tt>--enable-threads</tt> set during the <tt>configure</tt>
+process. IDE-based versions of FLTK are automatically compiled with
+locking enabled if possible.
+
+In <TT>main()</TT>, call
+<a href="Fl.html#Fl.lock"><TT>Fl::lock()</TT></A> before
+<A HREF="Fl.html#Fl.run"><TT>Fl::run()</TT></A> or
+<A HREF="Fl.html#Fl.wait"><TT>Fl::wait()</TT></A>
+to start the runtime
+multithreading support for your program. All callbacks and derived
+functions like <tt>handle()</tt> and <tt>draw()</tt> will now be properly
+locked:
+
+}
+
+\code
int main() {
Fl::lock();
/* run thread */
@@ -23,32 +40,32 @@ that will help you to get the most out of FLTK.</P>
}
}
}
-</pre>
+\endcode
-<P>You can now start as many threads as you like. From within
+You can now start as many threads as you like. From within
a thread (other than the main thread) FLTK calls must be wrapped
with calls to <a href="Fl.html#Fl.lock"><tt>Fl::lock()</tt></a>
and <a href="Fl.html#Fl.unlock"><tt>Fl::unlock()</tt></a>:
-<pre>
+\code
Fl::lock(); // avoid conflicting calls
... // your code here
Fl::unlock(); // allow other threads to access FLTK again
-</pre>
+\endcode
-<p>You can send messages from child threads to the main thread
+You can send messages from child threads to the main thread
using <a href="Fl.html#Fl.awake"><tt>Fl::awake(msg)</tt></a>:</p>
-<pre>
+\code
void *msg; // "msg" is a pointer to your message
Fl::awake(msg); // send "msg" to main thread
-</pre>
+\endcode
-<p>You can also tell the main thread to call a function for you
+You can also tell the main thread to call a function for you
as soon as possible by using
<a href="Fl.html#Fl.awake"><tt>Fl::awake(callback, userdata)</tt></a>:</p>
-<pre>
+\code
void do_something(void *userdata) {
// running with the main thread
}
@@ -56,32 +73,32 @@ as soon as possible by using
// running in another thread
void *data; // "data" is a pointer to your user data
Fl::awake(do_something, data); // call something in main thread
-</pre>
+\endcode
-<P>FLTK supports multiple platforms, some of them which do not
+FLTK supports multiple platforms, some of them which do not
allow any other but the main thread to handle system events and
open or close windows. The safe thing to do is to adhere to the
following rules for threads on all operating systems:
-<ul>
-
-<li>Don't <tt>show()</tt> or <tt>hide()</tt>anything that contains
-widgets derived from <tt>Fl_Window</tt>, including dialogs, file
-choosers, subwindows or <tt>Fl_GL_Window</tt>s</li>
-<li>Don't call <tt>Fl::wait()</tt>, <tt>Fl::flush()</tt> or any
-related methods that will handle system messages</li>
+\li Don't <tt>show()</tt> or <tt>hide()</tt>anything that contains
+ widgets derived from <tt>Fl_Window</tt>, including dialogs, file
+ choosers, subwindows or <tt>Fl_GL_Window</tt>s
-<li>Don't start or cancel timers</li>
+\li Don't call <tt>Fl::wait()</tt>, <tt>Fl::flush()</tt> or any
+ related methods that will handle system messages
-<li>Don't change window decorations or titles</li>
+\li Don't start or cancel timers
-<li>The <tt>make_current()</tt> method may or may not work well for regular windows, but should always work for <tt>Fl_GL_Window</tt>s to allow for high speed rendering on graphics cards with multiple pipelines</li>
+\li Don't change window decorations or titles
-</ul>
+\li The <tt>make_current()</tt> method may or may not work well for
+ regular windows, but should always work for <tt>Fl_GL_Window</tt>s
+ to allow for high speed rendering on graphics cards with multiple
+ pipelines
-<P>See also:
+See also:
<a href="Fl.html#Fl.awake">void awake(void *message)</A>,
<a href="Fl.html#Fl.lock">void lock()</A>,
<a href="Fl.html#Fl.thread_message">void *thread_message()</A>,