📄 mutex_8c-source.html
字号:
<a name="l00089"></a>00089 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00090"></a>00090 <a name="l00091"></a><a class="code" href="group__g__threads.html#gb0580aafc0e70358742e7c1e269895d5">00091</a> <a class="code" href="struct_o_c_i___mutex.html" title="OCILIB encapsulation of OCI mutexes.">OCI_Mutex</a> * OCI_API <a class="code" href="group__g__threads.html#gb0580aafc0e70358742e7c1e269895d5" title="Create a Mutex object.">OCI_MutexCreate</a>(<span class="keywordtype">void</span>)<a name="l00092"></a>00092 {<a name="l00093"></a>00093 <a class="code" href="struct_o_c_i___mutex.html" title="OCILIB encapsulation of OCI mutexes.">OCI_Mutex</a> *mutex = NULL;<a name="l00094"></a>00094 <a name="l00095"></a>00095 OCI_CHECK_INITIALIZED(NULL);<a name="l00096"></a>00096 <a name="l00097"></a>00097 mutex = OCI_MutexCreateInternal();<a name="l00098"></a>00098 <a name="l00099"></a>00099 OCI_RESULT(mutex != NULL);<a name="l00100"></a>00100 <a name="l00101"></a>00101 <span class="keywordflow">return</span> mutex;<a name="l00102"></a>00102 }<a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00105"></a>00105 <span class="comment"> * OCI_MutexFree</span><a name="l00106"></a>00106 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00107"></a>00107 <a name="l00108"></a><a class="code" href="group__g__threads.html#g90c5cb68c0144b7bda9b75906c752ab5">00108</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__threads.html#g90c5cb68c0144b7bda9b75906c752ab5" title="Destroy a mutex object.">OCI_MutexFree</a>(<a class="code" href="struct_o_c_i___mutex.html" title="OCILIB encapsulation of OCI mutexes.">OCI_Mutex</a> *mutex)<a name="l00109"></a>00109 {<a name="l00110"></a>00110 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00111"></a>00111 <a name="l00112"></a>00112 OCI_CHECK_PTR(OCI_IPC_MUTEX, mutex, FALSE);<a name="l00113"></a>00113 <a name="l00114"></a>00114 <span class="comment">/* close mutex handle */</span><a name="l00115"></a>00115 <a name="l00116"></a>00116 <span class="keywordflow">if</span> (mutex-><a class="code" href="struct_o_c_i___mutex.html#925a26eb4b1de86f16f0055c5cfd6f09">handle</a> != NULL)<a name="l00117"></a>00117 {<a name="l00118"></a>00118 OCI_CALL0<a name="l00119"></a>00119 (<a name="l00120"></a>00120 res, mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a>, <a name="l00121"></a>00121 <a name="l00122"></a>00122 OCIThreadMutexDestroy(OCILib.env, mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a>, &mutex-><a class="code" href="struct_o_c_i___mutex.html#925a26eb4b1de86f16f0055c5cfd6f09">handle</a>)<a name="l00123"></a>00123 )<a name="l00124"></a>00124 }<a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="comment">/* close error handle */</span><a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="keywordflow">if</span> (mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a> != NULL)<a name="l00129"></a>00129 {<a name="l00130"></a>00130 OCI_HandleFree(mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a>, OCI_HTYPE_ERROR);<a name="l00131"></a>00131 }<a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="comment">/* free mutex structure */</span><a name="l00134"></a>00134 <a name="l00135"></a>00135 OCI_FREE(mutex);<a name="l00136"></a>00136 <a name="l00137"></a>00137 OCI_RESULT(res);<a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="keywordflow">return</span> res;<a name="l00140"></a>00140 }<a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00143"></a>00143 <span class="comment"> * OCI_MutexAcquire</span><a name="l00144"></a>00144 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00145"></a>00145 <a name="l00146"></a><a class="code" href="group__g__threads.html#g88a05b41e24b3bd1789688702cc6f4f4">00146</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__threads.html#g88a05b41e24b3bd1789688702cc6f4f4" title="Acquire a mutex lock.">OCI_MutexAcquire</a>(<a class="code" href="struct_o_c_i___mutex.html" title="OCILIB encapsulation of OCI mutexes.">OCI_Mutex</a> *mutex)<a name="l00147"></a>00147 {<a name="l00148"></a>00148 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00149"></a>00149 <a name="l00150"></a>00150 OCI_CHECK_PTR(OCI_IPC_MUTEX, mutex, FALSE);<a name="l00151"></a>00151 <a name="l00152"></a>00152 OCI_CALL3<a name="l00153"></a>00153 (<a name="l00154"></a>00154 res, mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a>, <a name="l00155"></a>00155 <a name="l00156"></a>00156 OCIThreadMutexAcquire(OCILib.env, mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a>, mutex-><a class="code" href="struct_o_c_i___mutex.html#925a26eb4b1de86f16f0055c5cfd6f09">handle</a>)<a name="l00157"></a>00157 )<a name="l00158"></a>00158 <a name="l00159"></a>00159 OCI_RESULT(res);<a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keywordflow">return</span> res;<a name="l00162"></a>00162 }<a name="l00163"></a>00163 <a name="l00164"></a>00164 <span class="comment">/* ------------------------------------------------------------------------ *</span><a name="l00165"></a>00165 <span class="comment"> * OCI_MutexRelease</span><a name="l00166"></a>00166 <span class="comment"> * ------------------------------------------------------------------------ */</span><a name="l00167"></a>00167 <a name="l00168"></a><a class="code" href="group__g__threads.html#g366f287cf828533617faf0785181de7f">00168</a> <span class="keywordtype">boolean</span> OCI_API <a class="code" href="group__g__threads.html#g366f287cf828533617faf0785181de7f" title="Release a mutex lock.">OCI_MutexRelease</a>(<a class="code" href="struct_o_c_i___mutex.html" title="OCILIB encapsulation of OCI mutexes.">OCI_Mutex</a> *mutex)<a name="l00169"></a>00169 {<a name="l00170"></a>00170 <span class="keywordtype">boolean</span> res = TRUE;<a name="l00171"></a>00171 <a name="l00172"></a>00172 OCI_CHECK_PTR(OCI_IPC_MUTEX, mutex, FALSE);<a name="l00173"></a>00173 <a name="l00174"></a>00174 OCI_CALL3<a name="l00175"></a>00175 (<a name="l00176"></a>00176 res, mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a>, <a name="l00177"></a>00177 <a name="l00178"></a>00178 OCIThreadMutexRelease(OCILib.env, mutex-><a class="code" href="struct_o_c_i___mutex.html#d04d374203b92a9144ee4ea6645b75fa">err</a>, mutex-><a class="code" href="struct_o_c_i___mutex.html#925a26eb4b1de86f16f0055c5cfd6f09">handle</a>)<a name="l00179"></a>00179 )<a name="l00180"></a>00180 <a name="l00181"></a>00181 OCI_RESULT(res);<a name="l00182"></a>00182 <a name="l00183"></a>00183 <span class="keywordflow">return</span> TRUE;<a name="l00184"></a>00184 }</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Oct 9 10:07:43 2008 for OCILIB (C Driver for Oracle) by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.4 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -