Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/class_c_smp_example.html
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>TB10.1 Example Applications: CSmpExample Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.3 -->
<h1>CSmpExample Class Reference</h1><!-- doxytag: class="CSmpExample" -->
<p>
<a href="class_c_smp_example-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#4f902855860346e1529c8aad989100f0">~CSmpExample</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#6ed7d09453967159b3cb9cb8c271aeab">CreateDatabaseL</a> (const TDesC &aDbName)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#8eaf4cbbf9c4b69d0854140963a22e51">PrintMessage</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#fdb87a66a6b0a41cbea465aa2495aa1c">StartThreads</a> ()</td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="class_c_smp_example.html">CSmpExample</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#af2dab332a98167a1dde6309732a2460">NewL</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static TInt </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#c56a561b32603f3d9fccb186b90ee28b">ReadThreadFuncL</a> (TAny *aPtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static TInt </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#3a99e9be00e57c1d8489de6f62d00a2b">WriteThread1FuncL</a> (TAny *aPtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static TInt </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#41ccf5be445f2ad57cee4fa93b8830c6">WriteThread2FuncL</a> (TAny *aPtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#70e2ac4866c0bea841d38203ae2f6194">ReadBothDatabasesL</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#3b589411b99d71c460442290516e04ec">ReadDatabaseL</a> (const TDesC &aDbName, CConsoleBase &<a class="el" href="localeupdate_8cpp.html#d789d40251baeb2f60e118de4856583d">console</a>)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#26abdb02599626bb596e73e90a145037">WriteDbFuncL</a> (const TDesC &aDbName, TInt aNum)</td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_smp_example.html#a9bbdb0f3c1cb00236cf6eedc2fe0840">ConstructL</a> ()</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class creates three threads to demonstrate multithreading in a unicore and a SMP environment.
<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 & Destructor Documentation</h2>
<a class="anchor" name="4f902855860346e1529c8aad989100f0"></a><!-- doxytag: member="CSmpExample::~CSmpExample" ref="4f902855860346e1529c8aad989100f0" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">CSmpExample::~CSmpExample </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Destructor
<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><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="af2dab332a98167a1dde6309732a2460"></a><!-- doxytag: member="CSmpExample::NewL" ref="af2dab332a98167a1dde6309732a2460" 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> ) </td>
<td width="100%"><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<a class="el" href="class_c_smp_example.html#af2dab332a98167a1dde6309732a2460">NewL()</a>
<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><p>
<a class="anchor" name="6ed7d09453967159b3cb9cb8c271aeab"></a><!-- doxytag: member="CSmpExample::CreateDatabaseL" ref="6ed7d09453967159b3cb9cb8c271aeab" args="(const TDesC &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 & </td>
<td class="paramname"> <em>aDbName</em> </td>
<td> ) </td>
<td width="100%"></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>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><p>
<a class="anchor" name="c56a561b32603f3d9fccb186b90ee28b"></a><!-- doxytag: member="CSmpExample::ReadThreadFuncL" ref="c56a561b32603f3d9fccb186b90ee28b" 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 * </td>
<td class="paramname"> <em>aPtr</em> </td>
<td> ) </td>
<td width="100%"><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#70e2ac4866c0bea841d38203ae2f6194">ReadBothDatabasesL()</a> to read both the databases.
<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><p>
<a class="anchor" name="3a99e9be00e57c1d8489de6f62d00a2b"></a><!-- doxytag: member="CSmpExample::WriteThread1FuncL" ref="3a99e9be00e57c1d8489de6f62d00a2b" 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 * </td>
<td class="paramname"> <em>aPtr</em> </td>
<td> ) </td>
<td width="100%"><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#26abdb02599626bb596e73e90a145037">WriteDbFuncL()</a> to write integers to KDatabase1.
<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><p>
<a class="anchor" name="41ccf5be445f2ad57cee4fa93b8830c6"></a><!-- doxytag: member="CSmpExample::WriteThread2FuncL" ref="41ccf5be445f2ad57cee4fa93b8830c6" 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 * </td>
<td class="paramname"> <em>aPtr</em> </td>
<td> ) </td>
<td width="100%"><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#26abdb02599626bb596e73e90a145037">WriteDbFuncL()</a> to write integers to KDatabase2.
<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><p>
<a class="anchor" name="70e2ac4866c0bea841d38203ae2f6194"></a><!-- doxytag: member="CSmpExample::ReadBothDatabasesL" ref="70e2ac4866c0bea841d38203ae2f6194" 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> ) </td>
<td width="100%"><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a console, reads the databases and prints output to the console.
<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><p>
<a class="anchor" name="3b589411b99d71c460442290516e04ec"></a><!-- doxytag: member="CSmpExample::ReadDatabaseL" ref="3b589411b99d71c460442290516e04ec" args="(const TDesC &aDbName, CConsoleBase &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 & </td>
<td class="paramname"> <em>aDbName</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">CConsoleBase & </td>
<td class="paramname"> <em>console</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"><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>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><p>
<a class="anchor" name="26abdb02599626bb596e73e90a145037"></a><!-- doxytag: member="CSmpExample::WriteDbFuncL" ref="26abdb02599626bb596e73e90a145037" args="(const TDesC &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 & </td>
<td class="paramname"> <em>aDbName</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">TInt </td>
<td class="paramname"> <em>aNum</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"><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>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><p>
<a class="anchor" name="8eaf4cbbf9c4b69d0854140963a22e51"></a><!-- doxytag: member="CSmpExample::PrintMessage" ref="8eaf4cbbf9c4b69d0854140963a22e51" 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> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Prints welcome message and purpose of the example.
<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><p>
<a class="anchor" name="fdb87a66a6b0a41cbea465aa2495aa1c"></a><!-- doxytag: member="CSmpExample::StartThreads" ref="fdb87a66a6b0a41cbea465aa2495aa1c" 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> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Starts the three threads
<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><p>
<a class="anchor" name="a9bbdb0f3c1cb00236cf6eedc2fe0840"></a><!-- doxytag: member="CSmpExample::ConstructL" ref="a9bbdb0f3c1cb00236cf6eedc2fe0840" 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> ) </td>
<td width="100%"><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>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><p>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 21 10:33:07 2010 for TB10.1 Example Applications by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>