aboutsummaryrefslogtreecommitdiff
path: root/doc/oscl_html/oscl__lock__base_8h-source.html
blob: c17018236641b984e01f195e94a148d9a994f04d (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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>oscl_lock_base.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.18 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
<hr><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>00001 <span class="comment">// -*- c++ -*-</span>
00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
00003 
00004 <span class="comment">//               O S C L _ L O C K _ B A S E</span>
00005 
00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span>
00007 
00023 <span class="preprocessor">#ifndef OSCL_LOCK_BASE_H_INCLUDED</span>
00024 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_LOCK_BASE_H_INCLUDED</span>
00025 <span class="preprocessor"></span>
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>
00028 {
00029 
00030     <span class="keyword">public</span>:
00031         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclLockBase.html#a0">Lock</a>() = 0;
00032         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclLockBase.html#a1">Unlock</a>() = 0;
<a name="l00033"></a><a class="code" href="classOsclLockBase.html#a2">00033</a>         <span class="keyword">virtual</span> <a class="code" href="classOsclLockBase.html#a2">~OsclLockBase</a>() {}
00034 
00035 };
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>
00038 {
00039 
00040     <span class="keyword">public</span>:
<a name="l00041"></a><a class="code" href="classOsclNullLock.html#a0">00041</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclNullLock.html#a0">Lock</a>() {};
<a name="l00042"></a><a class="code" href="classOsclNullLock.html#a1">00042</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclNullLock.html#a1">Unlock</a>() {};
<a name="l00043"></a><a class="code" href="classOsclNullLock.html#a2">00043</a>         <span class="keyword">virtual</span> <a class="code" href="classOsclNullLock.html#a2">~OsclNullLock</a>() {}
00044 
00045 };
00046 
00047 
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">OsclScopedLock</a>
00061 {
00062     <span class="keyword">private</span>:
00063         LockClass* _Ptr;
00064 
00065         <span class="comment">// make copy constructor private so no default is created.</span>
00073 <span class="comment"></span>        <a class="code" href="classOsclScopedLock.html#a0">OsclScopedLock</a>(<span class="keyword">const</span> <a class="code" href="classOsclScopedLock.html">OsclScopedLock&lt;LockClass&gt;</a>&amp;) {}
00074 
00075 
00081         <span class="keywordtype">void</span> release()
00082         {
00083             <span class="keywordflow">if</span> (_Ptr)
00084             {
00085                 _Ptr-&gt;Unlock();
00086                 _Ptr = <a class="code" href="group__osclbase.html#a81">NULL</a>;
00087             }
00088         }
00089 
00090 
00095         <span class="keywordtype">void</span> acquire()
00096         {
00097             <span class="keywordflow">if</span> (_Ptr)
00098             {
00099                 _Ptr-&gt;Lock();
00100             }
00101         }
00102 
00103 
00104     <span class="keyword">public</span>:
00105 
<a name="l00110"></a><a class="code" href="classOsclScopedLock.html#a0">00110</a>         <span class="keyword">explicit</span> <a class="code" href="classOsclScopedLock.html#a0">OsclScopedLock</a>(LockClass&amp; inLock) : _Ptr(&amp;inLock)
00111         {
00112             acquire();
00113         };
00114 
<a name="l00120"></a><a class="code" href="classOsclScopedLock.html#a1">00120</a>         <a class="code" href="classOsclScopedLock.html#a1">~OsclScopedLock</a>()
00121         {
00122             release();
00123         }
00124 
00125 
00126 
00127 };
00128 
00129 
00133 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
</small></address>
</body>
</html>