|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
2 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
3 <head> |
|
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
|
5 <title>TB9.2 Example Applications: examples/PIPS/opencproducerconsumerex/inc/commanheader.h Source File</title> |
|
6 <link href="tabs.css" rel="stylesheet" type="text/css"/> |
|
7 <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
|
8 </head> |
|
9 <body> |
|
10 <!-- Generated by Doxygen 1.6.2 --> |
|
11 <h1>examples/PIPS/opencproducerconsumerex/inc/commanheader.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
|
12 <a name="l00016"></a>00016 <span class="preprocessor">#ifndef COMMANHEADER_H</span> |
|
13 <a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#define COMMANHEADER_H</span> |
|
14 <a name="l00018"></a>00018 <span class="preprocessor"></span> |
|
15 <a name="l00019"></a>00019 <span class="comment">/* INCLUDE FILES */</span> |
|
16 <a name="l00020"></a>00020 <span class="preprocessor">#include <semaphore.h></span> |
|
17 <a name="l00021"></a>00021 |
|
18 <a name="l00022"></a>00022 <span class="preprocessor">#define MAX_CLIENTS 10</span> |
|
19 <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define KPortNum 2222</span> |
|
20 <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define KMSGQKEY 1000</span> |
|
21 <a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define KMAXSENDMSG 100</span> |
|
22 <a name="l00026"></a>00026 <span class="preprocessor"></span> |
|
23 <a name="l00027"></a>00027 <span class="preprocessor">#define IN_SET_LOOPBACK_ADDR(a) \</span> |
|
24 <a name="l00028"></a>00028 <span class="preprocessor"> { (a)->sin_addr.s_addr = 0x0100007F; (a)->sin_family = AF_INET; }</span> |
|
25 <a name="l00029"></a>00029 <span class="preprocessor"></span> |
|
26 <a name="l00030"></a>00030 |
|
27 <a name="l00031"></a>00031 <span class="comment">/* Structure used for sending details to the Producer and Consumers */</span> |
|
28 <a name="l00032"></a><a class="code" href="struct_thread_param.html">00032</a> <span class="keyword">typedef</span> <span class="keyword">struct </span> |
|
29 <a name="l00033"></a>00033 { |
|
30 <a name="l00034"></a>00034 <span class="keywordtype">int</span> noOfItems; |
|
31 <a name="l00035"></a>00035 <span class="keywordtype">int</span> noOfConsumers; |
|
32 <a name="l00036"></a>00036 sem_t itemLock; |
|
33 <a name="l00037"></a>00037 } <a class="code" href="struct_thread_param.html">ThreadParam</a>; |
|
34 <a name="l00038"></a>00038 |
|
35 <a name="l00039"></a>00039 <span class="comment">/* Structure defining Items to be Produced */</span> |
|
36 <a name="l00040"></a><a class="code" href="struct_produced_item.html">00040</a> <span class="keyword">typedef</span> <span class="keyword">struct </span> |
|
37 <a name="l00041"></a>00041 { |
|
38 <a name="l00042"></a>00042 <span class="keywordtype">int</span> itemNum; |
|
39 <a name="l00043"></a>00043 <span class="keywordtype">char</span> itemName[50]; |
|
40 <a name="l00044"></a>00044 } <a class="code" href="struct_produced_item.html">ProducedItem</a>; |
|
41 <a name="l00045"></a>00045 |
|
42 <a name="l00046"></a>00046 |
|
43 <a name="l00047"></a>00047 |
|
44 <a name="l00054"></a>00054 <span class="keywordtype">void</span>* <a class="code" href="producer_8c.html#a9ba1d3d3c7c4fefedf72684e9abdc8ee">ProducerThreadEntryPoint</a>( <span class="keywordtype">void</span>* aParam ); |
|
45 <a name="l00055"></a>00055 |
|
46 <a name="l00062"></a>00062 <span class="keywordtype">void</span>* <a class="code" href="consumer_8c.html#aeb7daec86aaf17cff923e4e69e1ca964">ConsumerThreadEntryPoint</a>( <span class="keywordtype">void</span>* aParam ); |
|
47 <a name="l00063"></a>00063 |
|
48 <a name="l00064"></a>00064 <span class="preprocessor">#ifdef __cplusplus</span> |
|
49 <a name="l00065"></a>00065 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> |
|
50 <a name="l00066"></a>00066 { |
|
51 <a name="l00067"></a>00067 <span class="preprocessor">#endif</span> |
|
52 <a name="l00068"></a>00068 <span class="preprocessor"></span> |
|
53 <a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="observer_8cpp.html#abe25ac9eb42087610e2949b201e2f0b5">CreateObserverThread</a>( <span class="keywordtype">int</span> aNoOfMsg ); |
|
54 <a name="l00075"></a>00075 |
|
55 <a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="stack_8cpp.html#a90e98e7c8440177d0df072df573cc038">PushOntoStack</a>( <a class="code" href="struct_produced_item.html">ProducedItem</a>* aItem ); |
|
56 <a name="l00083"></a>00083 |
|
57 <a name="l00088"></a>00088 <a class="code" href="struct_produced_item.html">ProducedItem</a>* <a class="code" href="stack_8cpp.html#aaf42677487a6b410248a6c4fef8979fd">PopFromStack</a>(); |
|
58 <a name="l00089"></a>00089 |
|
59 <a name="l00095"></a>00095 <span class="keywordtype">void</span> <a class="code" href="stack_8cpp.html#ac0da5b0fd0c1fbbee12568b2cfbf5354">FreeItem</a>(<a class="code" href="struct_produced_item.html">ProducedItem</a>* aItem); |
|
60 <a name="l00096"></a>00096 |
|
61 <a name="l00097"></a>00097 <span class="preprocessor">#ifdef __cplusplus</span> |
|
62 <a name="l00098"></a>00098 <span class="preprocessor"></span>} |
|
63 <a name="l00099"></a>00099 <span class="preprocessor">#endif</span> |
|
64 <a name="l00100"></a>00100 <span class="preprocessor"></span> |
|
65 <a name="l00101"></a>00101 |
|
66 <a name="l00102"></a>00102 <span class="preprocessor">#endif </span><span class="comment">/*COMMANHEADER_H*/</span> |
|
67 <a name="l00103"></a>00103 |
|
68 <a name="l00104"></a>00104 <span class="comment">/* End of File */</span> |
|
69 </pre></div></div> |
|
70 <hr size="1"/><address style="text-align: right;"><small>Generated by |
|
71 <a href="http://www.doxygen.org/index.html"> |
|
72 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> |
|
73 </body> |
|
74 </html> |