📄 threads_8h-source.html.svn-base
字号:
<!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>odbc++/threads.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.2.13.1 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> </center><hr><h1>odbc++/threads.h</h1><div class="fragment"><pre>00001 <font class="comment">/* </font>00002 <font class="comment"> This file is part of libodbc++.</font>00003 <font class="comment"> </font>00004 <font class="comment"> Copyright (C) 1999-2000 Manush Dodunekov <manush@stendahls.net></font>00005 <font class="comment"> </font>00006 <font class="comment"> This library is free software; you can redistribute it and/or</font>00007 <font class="comment"> modify it under the terms of the GNU Library General Public</font>00008 <font class="comment"> License as published by the Free Software Foundation; either</font>00009 <font class="comment"> version 2 of the License, or (at your option) any later version.</font>00010 <font class="comment"> </font>00011 <font class="comment"> This library is distributed in the hope that it will be useful,</font>00012 <font class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</font>00013 <font class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>00014 <font class="comment"> Library General Public License for more details.</font>00015 <font class="comment"> </font>00016 <font class="comment"> You should have received a copy of the GNU Library General Public License</font>00017 <font class="comment"> along with this library; see the file COPYING. If not, write to</font>00018 <font class="comment"> the Free Software Foundation, Inc., 59 Temple Place - Suite 330,</font>00019 <font class="comment"> Boston, MA 02111-1307, USA.</font>00020 <font class="comment">*/</font>00021 00022 <font class="preprocessor">#ifndef __ODBCXX_THREADS_H</font>00023 <font class="preprocessor"></font><font class="preprocessor">#define __ODBCXX_THREADS_H</font>00024 <font class="preprocessor"></font>00025 <font class="preprocessor">#include <odbc++/setup.h></font>00026 00027 <font class="preprocessor">#if defined(ODBCXX_ENABLE_THREADS)</font>00028 <font class="preprocessor"></font>00029 <font class="preprocessor">#if !defined(WIN32)</font>00030 <font class="preprocessor"></font><font class="preprocessor"># include <pthread.h></font>00031 <font class="preprocessor">#endif</font>00032 <font class="preprocessor"></font>00033 <font class="keyword">namespace </font>odbc {00034 00035 <font class="keyword">class </font>ODBCXX_EXPORT Mutex {00036 <font class="keyword">private</font>:00037 <font class="preprocessor">#if !defined(WIN32)</font>00038 <font class="preprocessor"></font> pthread_mutex_t mutex_;00039 <font class="preprocessor">#else</font>00040 <font class="preprocessor"></font> CRITICAL_SECTION mutex_;00041 <font class="preprocessor">#endif</font>00042 <font class="preprocessor"></font>00043 Mutex(<font class="keyword">const</font> Mutex&);00044 Mutex& operator=(<font class="keyword">const</font> Mutex&);00045 00046 <font class="keyword">public</font>:00047 <font class="keyword">explicit</font> Mutex();00048 ~Mutex();00049 00050 <font class="keywordtype">void</font> lock();00051 <font class="keywordtype">void</font> unlock();00052 };00053 00054 <font class="keyword">class </font>ODBCXX_EXPORT Locker {00055 <font class="keyword">private</font>:00056 Mutex& m_;00057 <font class="keyword">public</font>:00058 Locker(Mutex& m)00059 :m_(m) {00060 m_.lock();00061 }00062 00063 ~Locker() {00064 m_.unlock();00065 }00066 };00067 00068 } <font class="comment">//namespace odbc</font>00069 00070 <font class="comment">// macro used all over the place</font>00071 <font class="preprocessor">#define ODBCXX_LOCKER(mut) odbc::Locker _locker(mut)</font>00072 <font class="preprocessor"></font>00073 <font class="preprocessor">#else // !ODBCXX_ENABLE_THREADS</font>00074 <font class="preprocessor"></font>00075 <font class="preprocessor">#define ODBCXX_LOCKER(mut) ((void)0)</font>00076 <font class="preprocessor"></font>00077 <font class="preprocessor">#endif</font>00078 <font class="preprocessor"></font>00079 <font class="preprocessor">#endif // __ODBCXX_THREADS_H</font></pre></div><hr><div align=center><a class=footer href="http://orcane.net/freeodbc++/">Go back to the freeodbc++ homepage</a></div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -