Click here to Skip to main content
15,895,142 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 102.1K   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_thread.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_thread.h</h1><a href="spl__thread_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_THREAD_H__</span>
00037 <span class="preprocessor"></span><span class="preprocessor">#define         __SPL_THREAD_H__</span>
00038 <span class="preprocessor"></span>
00039 <span class="preprocessor">#if     defined ( linux )</span>
00040 <span class="preprocessor"></span><span class="comment">//      SPL_PLATFORM == SPL_PLATFORM_LINUX</span>
00041 <span class="preprocessor">#include        &lt;errno.h&gt;</span>
00042 <span class="preprocessor">#include        &lt;pthread.h&gt;</span>
00043 <span class="preprocessor">#endif</span>
00044 <span class="preprocessor"></span>
00045 <span class="preprocessor">#if defined ( WIN32 )</span>
00046 <span class="preprocessor"></span>                <span class="comment">//      SPL_PLATFORM == SPL_PLATFORM_WIN32</span>
00047 <span class="preprocessor">#include        &lt;windows.h&gt;</span>
00048 <span class="preprocessor">#endif</span>
00049 <span class="preprocessor"></span>
00050 <span class="preprocessor">#ifndef         EBUSY</span>
<a name="l00051"></a><a class="code" href="spl__thread_8h.html#a0">00051</a> <span class="preprocessor"></span><span class="preprocessor">#define         EBUSY   16      </span>
00052 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00053 <span class="preprocessor"></span>
00054 
00055 <span class="preprocessor">#if SPL_PLATFORM == SPL_PLATFORM_WIN32</span>
00056 <span class="preprocessor"></span><span class="preprocessor">        #if             defined ( SPL_MAKE_DLL )</span>
00057 <span class="preprocessor"></span><span class="preprocessor">                #define SPL_API         __declspec( dllexport )</span>
00058 <span class="preprocessor"></span><span class="preprocessor">        #elif   defined ( SPL_USE_DLL )</span>
00059 <span class="preprocessor"></span><span class="preprocessor">                #define SPL_API         __declspec( dllimport )</span>
00060 <span class="preprocessor"></span><span class="preprocessor">        #else </span>
<a name="l00061"></a><a class="code" href="spl__thread_8h.html#a1">00061</a> <span class="preprocessor"></span><span class="preprocessor">                #define SPL_API </span>
00062 <span class="preprocessor"></span><span class="preprocessor">        #endif</span>
00063 <span class="preprocessor"></span><span class="preprocessor">#else</span>
00064 <span class="preprocessor"></span><span class="preprocessor">        #define SPL_API </span>
00065 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
00066 <span class="preprocessor"></span>
00067 <span class="keyword">namespace </span>SPL 
00068 {
00069 
00070 <span class="comment">//---------------------------------------------------------------------------------------------------------------------------</span>
00073 <span class="comment"></span><span class="comment">//---------------------------------------------------------------------------------------------------------------------------</span>
<a name="l00074"></a><a class="code" href="classSPL_1_1slcThread.html">00074</a> <span class="keyword">class </span><a class="code" href="classSPL_1_1slcThread.html">slcThread</a>
00075 {
00076         <span class="comment">//</span>
00077         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00078         <span class="comment">//***********************************************     CON/DESTRUCTION     ***********************************************</span>
00079         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00080         <span class="comment">//</span>
00081 <span class="keyword">protected</span>:
00082 
00083         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00085 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00086         <a class="code" href="spl__pluginargs_8h.html#a0">SPL_API</a> <a class="code" href="classSPL_1_1slcThread.html#b0">slcThread</a>( <span class="keywordtype">void</span> );
00087 
00088         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00090 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00091         <span class="keyword">virtual</span> <a class="code" href="spl__pluginargs_8h.html#a0">SPL_API</a> <a class="code" href="classSPL_1_1slcThread.html#b1">~slcThread</a>( <span class="keywordtype">void</span> );
00092 
00093         <span class="comment">//</span>
00094         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00095         <span class="comment">//************************************************     MODIFICATION     *************************************************</span>
00096         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00097         <span class="comment">//</span>
00098 <span class="keyword">public</span>:
00099 
00100         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00102 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00103         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="spl__pluginargs_8h.html#a0">SPL_API</a> <a class="code" href="classSPL_1_1slcThread.html#a0">Lock</a>( <span class="keywordtype">void</span> );
00104 
00105         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00110 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00111         <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="spl__pluginargs_8h.html#a0">SPL_API</a> <a class="code" href="classSPL_1_1slcThread.html#a1">TryLock</a>( <span class="keywordtype">void</span> );
00112 
00113         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00115 <span class="comment"></span>        <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00116         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="spl__pluginargs_8h.html#a0">SPL_API</a> <a class="code" href="classSPL_1_1slcThread.html#a2">Unlock</a>( <span class="keywordtype">void</span> );
00117 
00118         <span class="comment">//</span>
00119         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00120         <span class="comment">//*************************************************     ATTRIBUTES     **************************************************</span>
00121         <span class="comment">//-----------------------------------------------------------------------------------------------------------------------</span>
00122         <span class="comment">//</span>
00123 <span class="keyword">private</span>:
00124 
00125 <span class="preprocessor">#if defined ( WIN32 )</span>
00126 <span class="preprocessor"></span><span class="comment">//      SPL_PLATFORM == SPL_PLATFORM_WIN32              </span>
00127         
00128         HANDLE                          m_access;                               
00129         SECURITY_ATTRIBUTES m_sa;
00130 
00131 <span class="preprocessor">#elif defined ( linux ) </span>
00132 <span class="preprocessor"></span><span class="comment">//SPL_PLATFORM == SPL_PLATFORM_LINUX</span>
00133 
00134         pthread_mutex_t         m_access;                               
00135 
00136 <span class="preprocessor">#endif  </span>
00137 <span class="preprocessor"></span>};
00138 
00139 } <span class="comment">// End of namespace SPL</span>
00140 
00141 <span class="preprocessor">#endif  // __SPL_THREAD_H__</span>
00142 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun May 9 04:39:47 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