| <!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> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </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><<span class="keyword">class</span> LockClass> <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<LockClass></a>&) {} |
| 00074 |
| 00075 |
| 00081 <span class="keywordtype">void</span> release() |
| 00082 { |
| 00083 <span class="keywordflow">if</span> (_Ptr) |
| 00084 { |
| 00085 _Ptr->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->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& inLock) : _Ptr(&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> |