File: cs_251.html

package info (click to toggle)
crystalspace 0.94-20020412-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 62,276 kB
  • ctags: 52,843
  • sloc: cpp: 274,783; ansic: 6,608; perl: 6,276; objc: 3,952; asm: 2,942; python: 2,354; php: 542; pascal: 530; sh: 430; makefile: 370; awk: 193
file content (94 lines) | stat: -rw-r--r-- 3,959 bytes parent folder | download
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!-- 
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: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
 
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: NeXT Run-Loop</TITLE>

<META NAME="description" CONTENT="Crystal Space: NeXT Run-Loop">
<META NAME="keywords" CONTENT="Crystal Space: NeXT Run-Loop">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">

</HEAD>

<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC615"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_250.html#SEC614"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_252.html#SEC616"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_247.html#SEC611"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_248.html#SEC612"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_257.html#SEC623"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H4> 8.1.1.3 Run-Loop </H4>
<!--docid::SEC615::-->
<P>

The design of Crystal Space assumes that the programmer has full control over
the application's run-loop.  With most ports of Crystal Space, this is not a
problem since the main run-loop is generally implemented in this fashion:
</P><P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>bool csDefaultRunLoop(iObjectRegistry*)
{
  while (!shutdown)
    event_queue-&#62;Process();
}
</pre></td></tr></table></P><P>

With the AppKit, on the other hand, the main run-loop is not accessible to the
programmer and is essentially a black-box.  The above mechanism is easily
emulated with the AppKit using the following code:
</P><P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>bool csDefaultRunLoop(iObjectRegistry*)
{
  [NSApp run];
}
</pre></td></tr></table></P><P>

This code launches the AppKit's run-loop but does not address the problem of
periodically processing Crystal Space's event queue.  To solve this problem
`<SAMP>NeXTDelegate</SAMP>' artifically injects <EM>application-defined</EM> events into
the AppKit event queue and then triggers an invocation of
<CODE>iEventQueue::Process()</CODE> for each such received event.  In particular, 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,
OpenStep, and NextStep applications which already employ the AppKit'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><P>

<A NAME="NeXT Video Optimization"></A>
<HR SIZE=1>
<BR>  
<FONT SIZE="-1">
This document was generated

using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>

</BODY>
</HTML>