Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/class_c_smp_example.html
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 6 43e37759235e
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>TB9.2 Example Applications: CSmpExample Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="contents">
<h1>CSmpExample Class Reference</h1><!-- doxytag: class="CSmpExample" -->
<p><a href="class_c_smp_example-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a4f902855860346e1529c8aad989100f0">~CSmpExample</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a6ed7d09453967159b3cb9cb8c271aeab">CreateDatabaseL</a> (const TDesC &amp;aDbName)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a8eaf4cbbf9c4b69d0854140963a22e51">PrintMessage</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#afdb87a66a6b0a41cbea465aa2495aa1c">StartThreads</a> ()</td></tr>
<tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="class_c_smp_example.html">CSmpExample</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#aaf2dab332a98167a1dde6309732a2460">NewL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static TInt&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#ac56a561b32603f3d9fccb186b90ee28b">ReadThreadFuncL</a> (TAny *aPtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static TInt&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a3a99e9be00e57c1d8489de6f62d00a2b">WriteThread1FuncL</a> (TAny *aPtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static TInt&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a41ccf5be445f2ad57cee4fa93b8830c6">WriteThread2FuncL</a> (TAny *aPtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a70e2ac4866c0bea841d38203ae2f6194">ReadBothDatabasesL</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a3b589411b99d71c460442290516e04ec">ReadDatabaseL</a> (const TDesC &amp;aDbName, CConsoleBase &amp;console)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a26abdb02599626bb596e73e90a145037">WriteDbFuncL</a> (const TDesC &amp;aDbName, TInt aNum)</td></tr>
<tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#aa9bbdb0f3c1cb00236cf6eedc2fe0840">ConstructL</a> ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>This class creates three threads to demonstrate multithreading in a unicore and a SMP environment. </p>

<p>Definition at line <a class="el" href="_smp_example_8h_source.html#l00028">28</a> of file <a class="el" href="_smp_example_8h_source.html">SmpExample.h</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a4f902855860346e1529c8aad989100f0"></a><!-- doxytag: member="CSmpExample::~CSmpExample" ref="a4f902855860346e1529c8aad989100f0" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">CSmpExample::~CSmpExample </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Destructor </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00022">22</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aaf2dab332a98167a1dde6309732a2460"></a><!-- doxytag: member="CSmpExample::NewL" ref="aaf2dab332a98167a1dde6309732a2460" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_c_smp_example.html">CSmpExample</a> * CSmpExample::NewL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p><a class="el" href="class_c_smp_example.html#aaf2dab332a98167a1dde6309732a2460">NewL()</a> </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00033">33</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a6ed7d09453967159b3cb9cb8c271aeab"></a><!-- doxytag: member="CSmpExample::CreateDatabaseL" ref="a6ed7d09453967159b3cb9cb8c271aeab" args="(const TDesC &amp;aDbName)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSmpExample::CreateDatabaseL </td>
          <td>(</td>
          <td class="paramtype">const TDesC &amp;&nbsp;</td>
          <td class="paramname"> <em>aDbName</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates a named database with the name specified in the parameter, creates a table and adds columns to it. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00351">351</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ac56a561b32603f3d9fccb186b90ee28b"></a><!-- doxytag: member="CSmpExample::ReadThreadFuncL" ref="ac56a561b32603f3d9fccb186b90ee28b" args="(TAny *aPtr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">TInt CSmpExample::ReadThreadFuncL </td>
          <td>(</td>
          <td class="paramtype">TAny *&nbsp;</td>
          <td class="paramname"> <em>aPtr</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This function is called when iReadThread is resumed. It creates a cleanup stack and calls <a class="el" href="class_c_smp_example.html#a70e2ac4866c0bea841d38203ae2f6194">ReadBothDatabasesL()</a> to read both the databases. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00220">220</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a3a99e9be00e57c1d8489de6f62d00a2b"></a><!-- doxytag: member="CSmpExample::WriteThread1FuncL" ref="a3a99e9be00e57c1d8489de6f62d00a2b" args="(TAny *aPtr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">TInt CSmpExample::WriteThread1FuncL </td>
          <td>(</td>
          <td class="paramtype">TAny *&nbsp;</td>
          <td class="paramname"> <em>aPtr</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This function is called when iWriteThread is resumed. It creates a cleanup stack and calls <a class="el" href="class_c_smp_example.html#a26abdb02599626bb596e73e90a145037">WriteDbFuncL()</a> to write integers to KDatabase1. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00324">324</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a41ccf5be445f2ad57cee4fa93b8830c6"></a><!-- doxytag: member="CSmpExample::WriteThread2FuncL" ref="a41ccf5be445f2ad57cee4fa93b8830c6" args="(TAny *aPtr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">TInt CSmpExample::WriteThread2FuncL </td>
          <td>(</td>
          <td class="paramtype">TAny *&nbsp;</td>
          <td class="paramname"> <em>aPtr</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This function is called when iWriteThread is resumed. It creates a cleanup stack and calls <a class="el" href="class_c_smp_example.html#a26abdb02599626bb596e73e90a145037">WriteDbFuncL()</a> to write integers to KDatabase2. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00297">297</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a70e2ac4866c0bea841d38203ae2f6194"></a><!-- doxytag: member="CSmpExample::ReadBothDatabasesL" ref="a70e2ac4866c0bea841d38203ae2f6194" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSmpExample::ReadBothDatabasesL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates a console, reads the databases and prints output to the console. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00199">199</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a3b589411b99d71c460442290516e04ec"></a><!-- doxytag: member="CSmpExample::ReadDatabaseL" ref="a3b589411b99d71c460442290516e04ec" args="(const TDesC &amp;aDbName, CConsoleBase &amp;console)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSmpExample::ReadDatabaseL </td>
          <td>(</td>
          <td class="paramtype">const TDesC &amp;&nbsp;</td>
          <td class="paramname"> <em>aDbName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">CConsoleBase &amp;&nbsp;</td>
          <td class="paramname"> <em>console</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Opens the database named in the first parameter, reads it and prints the output to the console. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00131">131</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a26abdb02599626bb596e73e90a145037"></a><!-- doxytag: member="CSmpExample::WriteDbFuncL" ref="a26abdb02599626bb596e73e90a145037" args="(const TDesC &amp;aDbName, TInt aNum)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSmpExample::WriteDbFuncL </td>
          <td>(</td>
          <td class="paramtype">const TDesC &amp;&nbsp;</td>
          <td class="paramname"> <em>aDbName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">TInt&nbsp;</td>
          <td class="paramname"> <em>aNum</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Opens the database specified in the first parameter aDbName and writes consecutive integers to it starting from the number specified in the second parameter aNum. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00245">245</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a8eaf4cbbf9c4b69d0854140963a22e51"></a><!-- doxytag: member="CSmpExample::PrintMessage" ref="a8eaf4cbbf9c4b69d0854140963a22e51" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSmpExample::PrintMessage </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Prints welcome message and purpose of the example. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00106">106</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="afdb87a66a6b0a41cbea465aa2495aa1c"></a><!-- doxytag: member="CSmpExample::StartThreads" ref="afdb87a66a6b0a41cbea465aa2495aa1c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSmpExample::StartThreads </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Starts the three threads </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00075">75</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="aa9bbdb0f3c1cb00236cf6eedc2fe0840"></a><!-- doxytag: member="CSmpExample::ConstructL" ref="aa9bbdb0f3c1cb00236cf6eedc2fe0840" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CSmpExample::ConstructL </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Creates three threads; one for reading from the databases and the other two for writing to the databases. </p>

<p>Definition at line <a class="el" href="_smp_example_8cpp_source.html#l00045">45</a> of file <a class="el" href="_smp_example_8cpp_source.html">SmpExample.cpp</a>.</p>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>