Click here to Skip to main content
15,884,060 members
Articles / Desktop Programming / MFC

Multi platform plug-in development made easy!

Rate me:
Please Sign up or sign in to vote.
4.04/5 (25 votes)
7 Mar 20065 min read 100.6K   1.9K   63  
How to use and develop plug-ins for multiple platforms.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>SPL Library: spl_mutex.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>spl_mutex.h</h1><a href="spl__mutex_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00028 <span class="comment">//---------------------------------------------------------------------------------------------------------------------------</span>
00034 <span class="comment"></span><span class="comment">//---------------------------------------------------------------------------------------------------------------------------</span>
00035 
00036 <span class="preprocessor">#ifndef         __SPL_MUTEX_H__</span>
00037 <span class="preprocessor"></span><span class="preprocessor">#define         __SPL_MUTEX_H__</span>
00038 <span class="preprocessor"></span>
00039 <span class="preprocessor">#ifndef         __SPL_PLATFORM_H__</span>
00040 <span class="preprocessor"></span><span class="preprocessor">#include        "<a class="code" href="spl__platform_8h.html">spl_platform.h</a>"</span>
00041 <span class="preprocessor">#endif</span>
00042 <span class="preprocessor"></span>
00043 <span class="preprocessor">#if                             SPL_PLATFORM == SPL_PLATFORM_LINUX</span>
00044 <span class="preprocessor"></span><span class="preprocessor">        #include        &lt;errno.h&gt;</span>
00045 <span class="preprocessor">        #include        &lt;pthread.h&gt;</span>
00046 <span class="preprocessor">#endif</span>
00047 <span class="preprocessor"></span>
00048 <span class="preprocessor">#if                             SPL_PLATFORM == SPL_PLATFORM_WIN32</span>
00049 <span class="preprocessor"></span><span class="preprocessor">        #include        &lt;windows.h&gt;</span>
00050 <span class="preprocessor">#endif</span>
00051 <span class="preprocessor"></span>
00052 <span class="preprocessor">#ifndef         EBUSY</span>
<a name="l00053"></a><a class="code" href="spl__mutex_8h.html#a0">00053</a> <span class="preprocessor"></span><span class="preprocessor">#define         EBUSY   16      </span>
00054 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00055 <span class="preprocessor"></span>
00056 <span class="preprocessor">#if SPL_PLATFORM == SPL_PLATFORM_WIN32</span>
00057 <span class="preprocessor"></span><span class="preprocessor">        #if             defined ( SPL_MAKE_DLL )</span>
00058 <span class="preprocessor"></span><span class="preprocessor">                #define SPL_API         __declspec( dllexport )</span>
00059 <span class="preprocessor"></span><span class="preprocessor">        #elif   defined ( SPL_USE_DLL )</span>
00060 <span class="preprocessor"></span><span class="preprocessor">                #define SPL_API         __declspec( dllimport )</span>
00061 <span class="preprocessor"></span><span class="preprocessor">        #else </span>
00062 <span class="preprocessor"></span><span class="preprocessor">                #define SPL_API </span>
00063 <span class="preprocessor"></span><span class="preprocessor">        #endif</span>
00064 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00065"></a><a class="code" href="spl__mutex_8h.html#a1">00065</a> <span class="preprocessor"></span><span class="preprocessor">        #define SPL_API </span>
00066 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00067 <span class="preprocessor"></span>
<a name="l00068"></a><a class="code" href="namespaceSPL.html">00068</a> <span class="keyword">namespace </span>SPL 
00069 {
00070 
00071 <span class="comment">//---------------------------------------------------------------------------------------------------------------------------</span>
00074 <span class="comment"></span><span class="comment">//---------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00075"></a><a class="code" href="classSPL_1_1slcMutex.html">00075</a> <span class="keyword">class </span><a class="code" href="classSPL_1_1slcMutex.html">slcMutex</a>
00076 {
00077         <span class="comment">//</span>
00078         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00079         <span class="comment">//***********************************************     CON/DESTRUCTION     ***********************************************</span>
00080         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00081         <span class="comment">//</span>
00082 <span class="keyword">public</span>:
00083 
00084         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00086 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00087         <a class="code" href="spl__mutex_8h.html#a1">SPL_API</a> <a class="code" href="classSPL_1_1slcMutex.html#a0">slcMutex</a>( <span class="keywordtype">void</span> );
00088 
00089         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00091 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00092         <span class="keyword">virtual</span> <a class="code" href="spl__mutex_8h.html#a1">SPL_API</a> <a class="code" href="classSPL_1_1slcMutex.html#a1">~slcMutex</a>( <span class="keywordtype">void</span> );
00093 
00094         <span class="comment">//</span>
00095         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00096         <span class="comment">//************************************************     MODIFICATION     *************************************************</span>
00097         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00098         <span class="comment">//</span>
00099 <span class="keyword">public</span>:
00100 
00101         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00103 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00104         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="spl__mutex_8h.html#a1">SPL_API</a> <a class="code" href="classSPL_1_1slcMutex.html#a2">Lock</a>( <span class="keywordtype">void</span> );
00105 
00106         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00111 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00112         <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="spl__mutex_8h.html#a1">SPL_API</a> <a class="code" href="classSPL_1_1slcMutex.html#a3">TryLock</a>( <span class="keywordtype">void</span> );
00113 
00114         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00116 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00117         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="spl__mutex_8h.html#a1">SPL_API</a> <a class="code" href="classSPL_1_1slcMutex.html#a4">Unlock</a>( <span class="keywordtype">void</span> );
00118 
00119         <span class="comment">//</span>
00120         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00121         <span class="comment">//*************************************************     ATTRIBUTES     **************************************************</span>
00122         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00123         <span class="comment">//</span>
00124 <span class="keyword">private</span>:
00125 
00126 <span class="preprocessor">#if     SPL_PLATFORM == SPL_PLATFORM_WIN32              </span>
00127 <span class="preprocessor"></span>        
00128         HANDLE                          m_access;                               
00129         SECURITY_ATTRIBUTES m_sa;
00130 
00131 <span class="preprocessor">#elif SPL_PLATFORM == SPL_PLATFORM_LINUX</span>
00132 <span class="preprocessor"></span>
00133         pthread_mutex_t         m_access;                               
00134 
00135 <span class="preprocessor">#endif  </span>
00136 <span class="preprocessor"></span>};
00137 
00138 } <span class="comment">// End of namespace SPL</span>
00139 
00140 <span class="preprocessor">#endif  // __SPL_MUTEX_H__</span>
00141 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun May 9 15:01:04 2004 for SPL Library by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
I was born in 1982 near Stuttgart / Germany and began my first steps in programming computers at the age of only nine years on an old Commodore CBM 7072. In 2002 I finished my education as IT specialist for software engineering and did my civillian service afterwards. Currently I'm working as leader of the software division in a bigger company located in south west Germany, mainly on software development and research projects for multimedia terminals and user recognition/verification systems.

Comments and Discussions