📄 critsec_8h-source.html
字号:
<!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>critsec.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="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="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>critsec.h</h1><a href="critsec_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * critsec.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * Critical section mutex class.</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * Portable Windows Library</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * Copyright (C) 2004 Post Increment</span>00009 <span class="comment"> *</span>00010 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00011 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00012 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00013 <span class="comment"> * http://www.mozilla.org/MPL/</span>00014 <span class="comment"> *</span>00015 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00016 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00017 <span class="comment"> * the License for the specific language governing rights and limitations</span>00018 <span class="comment"> * under the License.</span>00019 <span class="comment"> *</span>00020 <span class="comment"> * The Original Code is Portable Windows Library.</span>00021 <span class="comment"> *</span>00022 <span class="comment"> * The Initial Developer of the Original Code is Post Increment</span>00023 <span class="comment"> *</span>00024 <span class="comment"> * Contributor(s): ______________________________________.</span>00025 <span class="comment"> *</span>00026 <span class="comment"> * $Log: critsec.h,v $</span>00027 <span class="comment"> * Revision 1.9 2004/05/16 23:31:07 csoutheren</span>00028 <span class="comment"> * Updated API documentation</span>00029 <span class="comment"> *</span>00030 <span class="comment"> * Revision 1.8 2004/05/12 04:36:13 csoutheren</span>00031 <span class="comment"> * Fixed problems with using sem_wait and friends on systems that do not</span>00032 <span class="comment"> * support atomic integers</span>00033 <span class="comment"> *</span>00034 <span class="comment"> * Revision 1.7 2004/04/21 11:22:56 csoutheren</span>00035 <span class="comment"> * Modified to work with gcc 3.4.0</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.6 2004/04/14 06:58:00 csoutheren</span>00038 <span class="comment"> * Fixed PAtomicInteger and PSmartPointer to use real atomic operations</span>00039 <span class="comment"> *</span>00040 <span class="comment"> * Revision 1.5 2004/04/12 03:35:26 csoutheren</span>00041 <span class="comment"> * Fixed problems with non-recursuve mutexes and critical sections on</span>00042 <span class="comment"> * older compilers and libc</span>00043 <span class="comment"> *</span>00044 <span class="comment"> * Revision 1.4 2004/04/12 00:58:45 csoutheren</span>00045 <span class="comment"> * Fixed PAtomicInteger on Linux, and modified PMutex to use it</span>00046 <span class="comment"> *</span>00047 <span class="comment"> * Revision 1.3 2004/04/12 00:36:04 csoutheren</span>00048 <span class="comment"> * Added new class PAtomicInteger and added Windows implementation</span>00049 <span class="comment"> *</span>00050 <span class="comment"> * Revision 1.2 2004/04/11 03:20:41 csoutheren</span>00051 <span class="comment"> * Added Unix implementation of PCriticalSection</span>00052 <span class="comment"> *</span>00053 <span class="comment"> * Revision 1.1 2004/04/11 02:55:17 csoutheren</span>00054 <span class="comment"> * Added PCriticalSection for Windows</span>00055 <span class="comment"> * Added compile time option for PContainer to use critical sections to provide thread safety under some circumstances</span>00056 <span class="comment"> *</span>00057 <span class="comment"> */</span>00058 00059 <span class="preprocessor">#ifndef _PCRITICALSECTION</span>00060 <span class="preprocessor"></span><span class="preprocessor">#define _PCRITICALSECTION</span>00061 <span class="preprocessor"></span>00062 <span class="preprocessor">#if P_HAS_ATOMIC_INT</span>00063 <span class="preprocessor"></span><span class="preprocessor">#if P_NEEDS_GNU_CXX_NAMESPACE</span>00064 <span class="preprocessor"></span><span class="preprocessor">#define EXCHANGE_AND_ADD(v,i) __gnu_cxx::__exchange_and_add(v,i)</span>00065 <span class="preprocessor"></span><span class="preprocessor">#else</span>00066 <span class="preprocessor"></span><span class="preprocessor">#define EXCHANGE_AND_ADD(v,i) __exchange_and_add(v,i)</span>00067 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00068 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00069 <span class="preprocessor"></span><a name="l00076"></a><a class="code" href="classPCriticalSection.html">00076</a> <span class="keyword">class </span><a class="code" href="classPCriticalSection.html">PCriticalSection</a> : <span class="keyword">public</span> <a class="code" href="classPObject.html">PObject</a>00077 {00078 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPCriticalSection.html">PCriticalSection</a>, <a class="code" href="classPObject.html">PObject</a>);00079 00080 <span class="keyword">public</span>:00085 <a class="code" href="object_8h.html#a2">PINLINE</a> <a class="code" href="classPCriticalSection.html#z77_0">PCriticalSection</a>();00086 00089 <a class="code" href="object_8h.html#a2">PINLINE</a> <a class="code" href="classPCriticalSection.html#z77_1">~PCriticalSection</a>();00091 00096 <a class="code" href="object_8h.html#a2">PINLINE</a> <span class="keywordtype">void</span> <a class="code" href="classPCriticalSection.html#z79_0">Enter</a>();00097 00100 <a class="code" href="object_8h.html#a2">PINLINE</a> <span class="keywordtype">void</span> <a class="code" href="classPCriticalSection.html#z79_1">Leave</a>();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -