1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../../css/manpage.css" type="text/css" />
7<title>StopDecoder</title>
8  </head>
9  <body>
10<h1><CODE><a href="../../../../nn/Overview.html">nn</a>::<a href="../../../../nn/jpeg/Overview.html">jpeg</a>::<a href="../../../../nn/jpeg/CTR/Overview.html">CTR</a>::<a href="../../../../nn/jpeg/CTR/JpegMpDecoder/Overview.html">JpegMpDecoder</a>::StopDecoder</CODE> Member Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">#include &lt;nn/jpeg.h&gt;
14
15void StopDecoder();
16</pre>
17    </div>
18<h2>Parameters</h2>
19    <div class="section">
20<p>None.</p>
21    </div>
22<h2>Return Values</h2>
23    <div class="section">
24None.
25               </div>
26<h2>Description</h2>
27    <div class="section">
28<p>Requests to stop decoding being performed by another thread.</p><p>This function sets a &quot;stop request flag&quot; inside the decoder object. The decoding functions (<CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/StartJpegDecoder.html">StartJpegDecoder</a></CODE>, <CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/StartJpegDecoderShrink.html">StartJpegDecoderShrink</a></CODE> and <CODE><a href="../../../../nn/jpeg/CTR/JpegMpDecoder/StartMpDecoderLR.html">StartMpDecoderLR</a></CODE>) monitor this flag and stop decoding when the flag is set.</p><p>Since decoder objects are not thread-safe, as a basic rule multiple threads cannot access the same decoder object.</p><p>However, during the periods of time when the application can check whether the decoder object is valid (meaning the object has been initialized and has not ended), this function can be called on the decoder object from a different thread.</p><p>Generally it takes some time to decode a JPEG image. Applications sometimes use a separate thread for decoding in order to maintain the response speed of the main thread.</p><p>For example, say you have a screen that shows a list of images, and you want to stop the decoding that has already begun for a certain image. To do this, you can call this function from a different thread (the main thread or an alarm handler) that has a higher priority than the decoding thread.</p><p>The stop request flag is cleared immediately before the decoding functions begin their main processing. The following conditions apply, so there is no certainty that simply calling this function once will stop ongoing decoding.</p><p>1. Decoding cannot be stopped before the decoding thread calls a decoding function or before control reaches the main decoding process within the function.<br />2. After main processing within decoding has completed, execution cannot be stopped. (Decoding will succeed unless another error occurs.)3. <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/StartMpDecoderLR.html">StartMpDecoderLR</a> clears flags each time two images are decoding. Decoding cannot be stopped during the period after the first image finishes decoding and before the second image begins decoding.</p><p>To deal with situations 1. and 3. above, you must continue to call this function (for example, in every game frame) until you have verified that decoding has been stopped, or has ended, whether in success or failure.</p><p>If a request to halt a decoding function is received, the function returns  (0), as it does when decoding fails. (The error code returned by <a href="../../../../nn/jpeg/CTR/JpegMpDecoder/GetLastError.html">GetLastError</a> is <span>JPEG_DECODER_ERROR_STOPPED</span> unless another error occurs.)</p><p>Stop requests cannot be canceled. Moreover, once decoding has stopped it cannot be resumed from the same point at which it stopped.</p><!-- write here --></div>
29<h2>Revision History</h2>
30    <div class="section">
31      <dl class="history">
32        <dt>2010/10/21</dt>
33<dd>Initial version.<br />
34        </dd>
35      </dl>
36    </div>
37  <hr><p>CONFIDENTIAL</p></body>
38</html>
39