Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bad97183153701b09df5fae1052b1c30 > files > 4211

crystalspace-doc-1.2.1-5mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<head>
<title>Crystal Space 1.2.1: 6.1.1.2 Run-Loop</title>

<meta name="description" content="Crystal Space 1.2.1: 6.1.1.2 Run-Loop">
<meta name="keywords" content="Crystal Space 1.2.1: 6.1.1.2 Run-Loop">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="MacOS_002fX-Run_002dLoop"></a>
<a name="0"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="MacOS_002fX-Contents.html#0" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="MacOS_002fX-Dynamic-Linking.html#0" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="Internals.html#0" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="MacOS_002fX-Details.html#0" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="Contributing.html#0" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<hr size="1">
<h4 class="subsubsection"> 6.1.1.2 Run-Loop </h4>

<p>The typical Crystal Space application assumes that the programmer has full
control over the application's run-loop.  For many platforms to which Crystal
Space has been ported, this is not a problem since the main run-loop is
generally implemented in this fashion:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">bool csDefaultRunLoop(iObjectRegistry*)
{
  while (!shutdown)
    event_queue-&gt;Process();
}
</pre></td></tr></table>
<p>With Cocoa, on the other hand, the main run-loop is not accessible to the
programmer and is essentially a black-box.  A simple-minded implementation of
the above functionality for Cocoa might look like this:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">bool csDefaultRunLoop(iObjectRegistry*)
{
  [NSApp run];
}
</pre></td></tr></table>
<p>This code launches the Cocoa run-loop but does not address the problem of
periodically processing Crystal Space's event queue.  To solve this problem
<samp>&lsquo;OSXDelegate&rsquo;</samp> artificially injects <em>application-defined</em> events into
the Cocoa event queue and then triggers an invocation of
<code>iEventQueue::Process()</code> for each such received event.  A single
application-defined event is injected into the event queue in order to begin
the process, and then an event is injected into the queue after each invocation
of <code>iEventQueue::Process()</code>.
</p>
<p>Note that <code>csDefaultRunLoop()</code> is provided as a convenience for
applications which do not otherwise supply their own run-loop.  Existing Cocoa
applications which already employ the <code>NSApplication</code>'s black-box run-loop
should not invoke <code>csDefaultRunLoop()</code>; but should instead arrange to have
<code>iEventQueue::Process()</code> invoked on a periodic basis via some other
mechanism.
</p>
<hr size="1">
<p>
 <font size="-1">
  This document was generated using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
 </font>
 <br>

</p>
</body>
</html>