mirror of
https://github.com/thestk/stk
synced 2026-01-12 12:31:53 +00:00
77 lines
5.4 KiB
HTML
77 lines
5.4 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
|
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<CENTER>
|
|
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
|
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.6.2 -->
|
|
<div class="navpath"><a class="el" href="dir_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>Mutex.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MUTEX_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MUTEX_H</span>
|
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
|
<a name="l00005"></a>00005
|
|
<a name="l00006"></a>00006 <span class="preprocessor">#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))</span>
|
|
<a name="l00007"></a>00007 <span class="preprocessor"></span>
|
|
<a name="l00008"></a>00008 <span class="preprocessor"> #include <pthread.h></span>
|
|
<a name="l00009"></a>00009 <span class="keyword">typedef</span> pthread_mutex_t MUTEX;
|
|
<a name="l00010"></a>00010 <span class="keyword">typedef</span> pthread_cond_t CONDITION;
|
|
<a name="l00011"></a>00011
|
|
<a name="l00012"></a>00012 <span class="preprocessor">#elif defined(__OS_WINDOWS__)</span>
|
|
<a name="l00013"></a>00013 <span class="preprocessor"></span>
|
|
<a name="l00014"></a>00014 <span class="preprocessor"> #include <windows.h></span>
|
|
<a name="l00015"></a>00015 <span class="preprocessor"> #include <process.h></span>
|
|
<a name="l00016"></a>00016 <span class="keyword">typedef</span> CRITICAL_SECTION MUTEX;
|
|
<a name="l00017"></a>00017 <span class="keyword">typedef</span> HANDLE CONDITION;
|
|
<a name="l00018"></a>00018
|
|
<a name="l00019"></a>00019 <span class="preprocessor">#endif</span>
|
|
<a name="l00020"></a>00020 <span class="preprocessor"></span>
|
|
<a name="l00021"></a>00021 <span class="keyword">namespace </span>stk {
|
|
<a name="l00022"></a>00022
|
|
<a name="l00023"></a>00023 <span class="comment">/***************************************************/</span>
|
|
<a name="l00034"></a>00034 <span class="comment">/***************************************************/</span>
|
|
<a name="l00035"></a>00035
|
|
<a name="l00036"></a><a class="code" href="classstk_1_1Mutex.html">00036</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
|
<a name="l00037"></a>00037 {
|
|
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
|
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Mutex.html#a869b23f40be55c01cc381290de1d1375" title="Default constructor.">Mutex</a>();
|
|
<a name="l00041"></a>00041
|
|
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1Mutex.html#a63df62eabfb7976e34951145d7a7ced3" title="Class destructor.">~Mutex</a>();
|
|
<a name="l00044"></a>00044
|
|
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#af2bb62c13745502b58644189d1db5b35" title="Lock the mutex.">lock</a>(<span class="keywordtype">void</span>);
|
|
<a name="l00047"></a>00047
|
|
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#ae518f6d3177dd8c2138eccb8944591ee" title="Unlock the mutex.">unlock</a>(<span class="keywordtype">void</span>);
|
|
<a name="l00050"></a>00050
|
|
<a name="l00052"></a>00052
|
|
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#afa637fae8940d6c3ad42384439962bbe" title="Wait indefinitely on the mutex condition variable.">wait</a>(<span class="keywordtype">void</span>);
|
|
<a name="l00057"></a>00057
|
|
<a name="l00059"></a>00059
|
|
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#ac3e3e69efa1587cb1f65fb645a8d43db" title="Signal the condition variable.">signal</a>(<span class="keywordtype">void</span>);
|
|
<a name="l00064"></a>00064
|
|
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
|
<a name="l00066"></a>00066
|
|
<a name="l00067"></a>00067 MUTEX mutex_;
|
|
<a name="l00068"></a>00068 CONDITION condition_;
|
|
<a name="l00069"></a>00069
|
|
<a name="l00070"></a>00070 };
|
|
<a name="l00071"></a>00071
|
|
<a name="l00072"></a>00072 } <span class="comment">// stk namespace</span>
|
|
<a name="l00073"></a>00073
|
|
<a name="l00074"></a>00074 <span class="preprocessor">#endif</span>
|
|
</pre></div></div>
|
|
<HR>
|
|
|
|
<table>
|
|
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
|
<tr><td>©1995-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|