aboutsummaryrefslogtreecommitdiff
path: root/doc/oscl_html/oscl__lock__base_8h_source.html
blob: 029840053ba6b27deae15a5f83c07b09f40bfc6e (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!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>oscl: oscl_lock_base.h Source File</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.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>oscl_lock_base.h</h1><a href="oscl__lock__base_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- c++ -*-</span>
<a name="l00002"></a>00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 <span class="comment">//               O S C L _ L O C K _ B A S E</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
<a name="l00007"></a>00007 
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef OSCL_LOCK_BASE_H_INCLUDED</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_LOCK_BASE_H_INCLUDED</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="classOsclLockBase.html">00027</a> <span class="keyword">class </span><a class="code" href="classOsclLockBase.html">OsclLockBase</a>
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029 
<a name="l00030"></a>00030     <span class="keyword">public</span>:
<a name="l00031"></a>00031         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclLockBase.html#a21d499c7b86d8dbb0bf3260bcb90877f">Lock</a>() = 0;
<a name="l00032"></a>00032         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclLockBase.html#a063f128a62a84012077e29eb12d26e1f">Unlock</a>() = 0;
<a name="l00033"></a><a class="code" href="classOsclLockBase.html#a8b526351b126b0163d1c8ff526907251">00033</a>         <span class="keyword">virtual</span> <a class="code" href="classOsclLockBase.html#a8b526351b126b0163d1c8ff526907251">~OsclLockBase</a>() {}
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 };
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="classOsclNullLock.html">00037</a> <span class="keyword">class </span><a class="code" href="classOsclNullLock.html">OsclNullLock</a>: <span class="keyword">public</span> <a class="code" href="classOsclLockBase.html">OsclLockBase</a>
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039 
<a name="l00040"></a>00040     <span class="keyword">public</span>:
<a name="l00041"></a><a class="code" href="classOsclNullLock.html#af85d7306244fa2a8e8d794d1bf0bab2e">00041</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclNullLock.html#af85d7306244fa2a8e8d794d1bf0bab2e">Lock</a>() {};
<a name="l00042"></a><a class="code" href="classOsclNullLock.html#a18ec0053cafbf7863b96afa9486c82cd">00042</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclNullLock.html#a18ec0053cafbf7863b96afa9486c82cd">Unlock</a>() {};
<a name="l00043"></a><a class="code" href="classOsclNullLock.html#af14fe36d3cec1f613fe848279493bfbe">00043</a>         <span class="keyword">virtual</span> <a class="code" href="classOsclNullLock.html#af14fe36d3cec1f613fe848279493bfbe">~OsclNullLock</a>() {}
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 };
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 
<a name="l00060"></a><a class="code" href="classOsclScopedLock.html">00060</a> <span class="keyword">template</span>&lt;<span class="keyword">class</span> LockClass&gt; <span class="keyword">class </span><a class="code" href="classOsclScopedLock.html" title="The OsclScopedLock class is a template class that handles unlocking an abstract class...">OsclScopedLock</a>
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062     <span class="keyword">private</span>:
<a name="l00063"></a>00063         LockClass* _Ptr;
<a name="l00064"></a>00064 
<a name="l00065"></a>00065         <span class="comment">// make copy constructor private so no default is created.</span>
<a name="l00073"></a>00073 <span class="comment"></span>        <a class="code" href="classOsclScopedLock.html" title="The OsclScopedLock class is a template class that handles unlocking an abstract class...">OsclScopedLock</a>(<span class="keyword">const</span> <a class="code" href="classOsclScopedLock.html" title="The OsclScopedLock class is a template class that handles unlocking an abstract class...">OsclScopedLock&lt;LockClass&gt;</a>&amp;) {}
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 
<a name="l00081"></a>00081         <span class="keywordtype">void</span> release()
<a name="l00082"></a>00082         {
<a name="l00083"></a>00083             <span class="keywordflow">if</span> (_Ptr)
<a name="l00084"></a>00084             {
<a name="l00085"></a>00085                 _Ptr-&gt;Unlock();
<a name="l00086"></a>00086                 _Ptr = <a class="code" href="group__osclbase.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="The NULL_TERM_CHAR is used to terminate c-style strings.">NULL</a>;
<a name="l00087"></a>00087             }
<a name="l00088"></a>00088         }
<a name="l00089"></a>00089 
<a name="l00090"></a>00090 
<a name="l00095"></a>00095         <span class="keywordtype">void</span> acquire()
<a name="l00096"></a>00096         {
<a name="l00097"></a>00097             <span class="keywordflow">if</span> (_Ptr)
<a name="l00098"></a>00098             {
<a name="l00099"></a>00099                 _Ptr-&gt;Lock();
<a name="l00100"></a>00100             }
<a name="l00101"></a>00101         }
<a name="l00102"></a>00102 
<a name="l00103"></a>00103 
<a name="l00104"></a>00104     <span class="keyword">public</span>:
<a name="l00105"></a>00105 
<a name="l00110"></a><a class="code" href="classOsclScopedLock.html#ae6923afbc91e9f94f24de70190f0b266">00110</a>         <span class="keyword">explicit</span> <a class="code" href="classOsclScopedLock.html" title="The OsclScopedLock class is a template class that handles unlocking an abstract class...">OsclScopedLock</a>(LockClass&amp; inLock) : _Ptr(&amp;inLock)
<a name="l00111"></a>00111         {
<a name="l00112"></a>00112             acquire();
<a name="l00113"></a>00113         };
<a name="l00114"></a>00114 
<a name="l00120"></a><a class="code" href="classOsclScopedLock.html#afe0f3002ec115b0fb257a85180c63834">00120</a>         <a class="code" href="classOsclScopedLock.html#afe0f3002ec115b0fb257a85180c63834" title="Destructor.">~OsclScopedLock</a>()
<a name="l00121"></a>00121         {
<a name="l00122"></a>00122             release();
<a name="l00123"></a>00123         }
<a name="l00124"></a>00124 
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 
<a name="l00127"></a>00127 };
<a name="l00128"></a>00128 
<a name="l00129"></a>00129 
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: CORE_9.002.1.1 </small>
</small></address>
</body>
</html>