Sophie

Sophie

distrib > * > 2009.0 > i586 > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 166

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_09) on Tue Aug 07 16:57:43 CEST 2007 -->
<TITLE>
QSemaphore
</TITLE>

<META NAME="keywords" CONTENT="com.trolltech.qt.core.QSemaphore class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="QSemaphore";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/trolltech/qt/core/QRegExp.PatternSyntax.html" title="enum in com.trolltech.qt.core"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/trolltech/qt/core/QSettings.html" title="class in com.trolltech.qt.core"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?com/trolltech/qt/core/QSemaphore.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="QSemaphore.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;<A HREF="#nested_classes_inherited_from_class_com.trolltech.qt.QSignalEmitter">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.trolltech.qt.core</FONT>
<BR>
Class QSemaphore</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">com.trolltech.qt.QSignalEmitter</A>
      <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">com.trolltech.qt.QtJambiObject</A>
          <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.trolltech.qt.core.QSemaphore</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../com/trolltech/qt/QtJambiInterface.html" title="interface in com.trolltech.qt">QtJambiInterface</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>QSemaphore</B><DT>extends <A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">QtJambiObject</A></DL>
</PRE>

<P>
<p>The <a href="QSemaphore.html#QSemaphore(int)"><tt>QSemaphore</tt></a> class provides a general counting semaphore.</p>
<p>A semaphore is a generalization of a mutex. While a mutex can only be locked once, it's possible to acquire a semaphore multiple times. Semaphores are typically used to protect a certain number of identical resources.</p>
<p>Semaphores support two fundamental operations, <a href="QSemaphore.html#acquire(int)"><tt>acquire</tt></a> and <a href="QSemaphore.html#release(int)"><tt>release</tt></a>:</p>
<ul>
<li>acquire(<i>n</i>) tries to acquire <i>n</i> resources. If there aren't that many resources available, the call will block until this is the case.</li>
<li>release(<i>n</i>) releases <i>n</i> resources.</li>
</ul>
<p>There's also a <a href="QSemaphore.html#tryAcquire(int, int)"><tt>tryAcquire</tt></a> function that returns immediately if it cannot acquire the resources, and an <a href="QSemaphore.html#available()"><tt>available</tt></a> function that returns the number of available resources at any time.</p>
<p>Example:</p>
<pre>    QSemaphore sem(5);      <span class="comment">// sem.available() == 5</span>

    sem.acquire(3);         <span class="comment">// sem.available() == 2</span>
    sem.acquire(2);         <span class="comment">// sem.available() == 0</span>
    sem.release(5);         <span class="comment">// sem.available() == 5</span>
    sem.release(5);         <span class="comment">// sem.available() == 10</span>

    sem.tryAcquire(1);      <span class="comment">// sem.available() == 9, returns true</span>
    sem.tryAcquire(250);    <span class="comment">// sem.available() == 9, returns false</span></pre>
<p>A typical application of semaphores is for controlling access to a circular buffer shared by a producer thread and a consumer thread. The Semaphores</tt> example shows how to use <a href="QSemaphore.html#QSemaphore(int)"><tt>QSemaphore</tt></a> to solve that problem.</p>
<p>A non-computing example of a semaphore would be dining at a restaurant. A semaphore is initialized with the number of chairs in the restaurant. As people arrive, they want a seat. As seats are filled, <a href="QSemaphore.html#available()"><tt>available</tt></a> is decremented. As people leave, the <a href="QSemaphore.html#available()"><tt>available</tt></a> is incremented, allowing more people to enter. If a party of 10 people want to be seated, but there are only 9 seats, those 10 people will wait, but a party of 4 people would be seated (taking the available seats to 5, making the party of 10 people wait longer).</p>
<P>

<P>
<DL>
<DT><B>See Also:</B><DD><a href="QMutex.html"><tt>QMutex</tt></a>, 
<a href="QWaitCondition.html"><tt>QWaitCondition</tt></a>, 
<tt>QThread</tt>, 
<CODE>Example</tt></CODE></DL>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->

<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
&nbsp;<A NAME="nested_classes_inherited_from_class_com.trolltech.qt.QSignalEmitter"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">QSignalEmitter</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal0.html" title="class in com.trolltech.qt">QSignalEmitter.Signal0</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal1.html" title="class in com.trolltech.qt">QSignalEmitter.Signal1</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal1.html" title="type parameter in QSignalEmitter.Signal1">A</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="class in com.trolltech.qt">QSignalEmitter.Signal2</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="type parameter in QSignalEmitter.Signal2">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="type parameter in QSignalEmitter.Signal2">B</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="class in com.trolltech.qt">QSignalEmitter.Signal3</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">C</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="class in com.trolltech.qt">QSignalEmitter.Signal4</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">D</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="class in com.trolltech.qt">QSignalEmitter.Signal5</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">E</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="class in com.trolltech.qt">QSignalEmitter.Signal6</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">F</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="class in com.trolltech.qt">QSignalEmitter.Signal7</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">G</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="class in com.trolltech.qt">QSignalEmitter.Signal8</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">G</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">H</A>&gt;, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="class in com.trolltech.qt">QSignalEmitter.Signal9</A>&lt;<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">G</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">H</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">I</A>&gt;</CODE></TD>
</TR>
</TABLE>
&nbsp;

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#QSemaphore()">QSemaphore</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equivalent to <a href="QSemaphore.html#QSemaphore(int)"><tt>QSemaphore</tt></a>(0).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#QSemaphore(int)">QSemaphore</A></B>(int&nbsp;n)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new semaphore and initializes the number of resources it guards to <tt>n</tt> (by default, 0).</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#acquire()">acquire</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equivalent to <a href="QSemaphore.html#acquire(int)">acquire</tt></a>(1).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#acquire(int)">acquire</A></B>(int&nbsp;n)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tries to acquire <tt>n</tt> resources guarded by the semaphore.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#available()">available</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of resources currently available to the semaphore.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../com/trolltech/qt/core/QSemaphore.html" title="class in com.trolltech.qt.core">QSemaphore</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#fromNativePointer(com.trolltech.qt.QNativePointer)">fromNativePointer</A></B>(<A HREF="../../../../com/trolltech/qt/QNativePointer.html" title="class in com.trolltech.qt">QNativePointer</A>&nbsp;nativePointer)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This function returns the QSemaphore instance pointed to by nativePointer</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#release()">release</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equivalent to <a href="QSemaphore.html#release(int)">release</tt></a>(1).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#release(int)">release</A></B>(int&nbsp;n)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Releases <tt>n</tt> resources guarded by the semaphore.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#tryAcquire()">tryAcquire</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Equivalent to <a href="QSemaphore.html#tryAcquire(int, int)"><tt>tryAcquire</tt></a>(1).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#tryAcquire(int)">tryAcquire</A></B>(int&nbsp;n)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tries to acquire <tt>n</tt> resources guarded by the semaphore and returns true on success.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/trolltech/qt/core/QSemaphore.html#tryAcquire(int, int)">tryAcquire</A></B>(int&nbsp;n,
           int&nbsp;timeout)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tries to acquire <tt>n</tt> resources guarded by the semaphore and returns true on success.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_com.trolltech.qt.QtJambiObject"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">QtJambiObject</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../com/trolltech/qt/QtJambiObject.html#dispose()">dispose</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#disposed()">disposed</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#finalize()">finalize</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#reassignNativeResources(com.trolltech.qt.QtJambiObject, java.lang.Class)">reassignNativeResources</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String)">tr</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String, java.lang.String)">tr</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String, java.lang.String, int)">tr</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_com.trolltech.qt.QSignalEmitter"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">QSignalEmitter</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#blockSignals(boolean)">blockSignals</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#disconnect()">disconnect</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#disconnect(java.lang.Object)">disconnect</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#signalsBlocked()">signalsBlocked</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#signalSender()">signalSender</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#thread()">thread</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_com.trolltech.qt.QtJambiInterface"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from interface com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QtJambiInterface.html" title="interface in com.trolltech.qt">QtJambiInterface</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#disableGarbageCollection()">disableGarbageCollection</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#nativeId()">nativeId</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#nativePointer()">nativePointer</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#reenableGarbageCollection()">reenableGarbageCollection</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#setJavaOwnership()">setJavaOwnership</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="QSemaphore()"><!-- --></A><H3>
QSemaphore</H3>
<PRE>
public <B>QSemaphore</B>()</PRE>
<DL>
<DD><p>Equivalent to <a href="QSemaphore.html#QSemaphore(int)"><tt>QSemaphore</tt></a>(0).
<P>
</DL>
<HR>

<A NAME="QSemaphore(int)"><!-- --></A><H3>
QSemaphore</H3>
<PRE>
public <B>QSemaphore</B>(int&nbsp;n)</PRE>
<DL>
<DD><p>Creates a new semaphore and initializes the number of resources it guards to <tt>n</tt> (by default, 0).</p>
<P>
<DL>
<DT><B>See Also:</B><DD><a href="QSemaphore.html#release(int)"><tt>release</tt></a>, 
<a href="QSemaphore.html#available()"><tt>available</tt></a></DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="acquire()"><!-- --></A><H3>
acquire</H3>
<PRE>
public final void <B>acquire</B>()</PRE>
<DL>
<DD><p>Equivalent to <a href="QSemaphore.html#acquire(int)">acquire</tt></a>(1).
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="acquire(int)"><!-- --></A><H3>
acquire</H3>
<PRE>
public final void <B>acquire</B>(int&nbsp;n)</PRE>
<DL>
<DD><p>Tries to acquire <tt>n</tt> resources guarded by the semaphore. If <tt>n</tt> &gt; <a href="QSemaphore.html#available()"><tt>available</tt></a>, this call will block until enough resources are available.</p>
<P>
<DD><DL>
<DT><B>See Also:</B><DD><a href="QSemaphore.html#release(int)"><tt>release</tt></a>, 
<a href="QSemaphore.html#available()"><tt>available</tt></a>, 
<a href="QSemaphore.html#tryAcquire(int, int)"><tt>tryAcquire</tt></a></DL>
</DD>
</DL>
<HR>

<A NAME="available()"><!-- --></A><H3>
available</H3>
<PRE>
public final int <B>available</B>()</PRE>
<DL>
<DD><p>Returns the number of resources currently available to the semaphore. This number can never be negative.</p>
<P>
<DD><DL>
<DT><B>See Also:</B><DD><a href="QSemaphore.html#acquire(int)"><tt>acquire</tt></a>, 
<a href="QSemaphore.html#release(int)"><tt>release</tt></a></DL>
</DD>
</DL>
<HR>

<A NAME="release()"><!-- --></A><H3>
release</H3>
<PRE>
public final void <B>release</B>()</PRE>
<DL>
<DD><p>Equivalent to <a href="QSemaphore.html#release(int)">release</tt></a>(1).
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="release(int)"><!-- --></A><H3>
release</H3>
<PRE>
public final void <B>release</B>(int&nbsp;n)</PRE>
<DL>
<DD><p>Releases <tt>n</tt> resources guarded by the semaphore.</p>
<p>This function can be used to &quot;create&quot; resources as well. For example:</p>
<pre>    QSemaphore sem(5);      <span class="comment">// a semaphore that guards 5 resources</span>
    sem.acquire(5);         <span class="comment">// acquire all 5 resources</span>
    sem.release(5);         <span class="comment">// release the 5 resources</span>
    sem.release(10);        <span class="comment">// &quot;create&quot; 10 new resources</span></pre>
<P>
<DD><DL>
<DT><B>See Also:</B><DD><a href="QSemaphore.html#acquire(int)"><tt>acquire</tt></a>, 
<a href="QSemaphore.html#available()"><tt>available</tt></a></DL>
</DD>
</DL>
<HR>

<A NAME="tryAcquire()"><!-- --></A><H3>
tryAcquire</H3>
<PRE>
public final boolean <B>tryAcquire</B>()</PRE>
<DL>
<DD><p>Equivalent to <a href="QSemaphore.html#tryAcquire(int, int)"><tt>tryAcquire</tt></a>(1).
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="tryAcquire(int)"><!-- --></A><H3>
tryAcquire</H3>
<PRE>
public final boolean <B>tryAcquire</B>(int&nbsp;n)</PRE>
<DL>
<DD><p>Tries to acquire <tt>n</tt> resources guarded by the semaphore and returns true on success. If <a href="QSemaphore.html#available()"><tt>available</tt></a> &lt; <tt>n</tt>, this call immediately returns false without acquiring any resources.</p>
<p>Example:</p>
<pre>    QSemaphore sem(5);      <span class="comment">// sem.available() == 5</span>
    sem.tryAcquire(250);    <span class="comment">// sem.available() == 5, returns false</span>
    sem.tryAcquire(3);      <span class="comment">// sem.available() == 2, returns true</span></pre>
<P>
<DD><DL>
<DT><B>See Also:</B><DD><a href="QSemaphore.html#acquire(int)"><tt>acquire</tt></a></DL>
</DD>
</DL>
<HR>

<A NAME="tryAcquire(int, int)"><!-- --></A><H3>
tryAcquire</H3>
<PRE>
public final boolean <B>tryAcquire</B>(int&nbsp;n,
                                int&nbsp;timeout)</PRE>
<DL>
<DD><p>Tries to acquire <tt>n</tt> resources guarded by the semaphore and returns true on success. If <a href="QSemaphore.html#available()"><tt>available</tt></a> &lt; <tt>n</tt>, this call will wait for at most <tt>timeout</tt> milliseconds for resources to become available.</p>
<p>Note: Passing a negative number as the <tt>timeout</tt> is equivalent to calling <a href="QSemaphore.html#acquire(int)"><tt>acquire</tt></a>, i.e&#x2e; this function will wait forever for resources to become available if <tt>timeout</tt> is negative.</p>
<p>Example:</p>
<pre>    QSemaphore sem(5);            <span class="comment">// sem.available() == 5</span>
    sem.tryAcquire(250, 1000);    <span class="comment">// sem.available() == 5, waits 1000 milliseconds and returns false</span>
    sem.tryAcquire(3, 30000);     <span class="comment">// sem.available() == 2, returns true without waiting</span></pre>
<P>
<DD><DL>
<DT><B>See Also:</B><DD><a href="QSemaphore.html#acquire(int)"><tt>acquire</tt></a></DL>
</DD>
</DL>
<HR>

<A NAME="fromNativePointer(com.trolltech.qt.QNativePointer)"><!-- --></A><H3>
fromNativePointer</H3>
<PRE>
public static <A HREF="../../../../com/trolltech/qt/core/QSemaphore.html" title="class in com.trolltech.qt.core">QSemaphore</A> <B>fromNativePointer</B>(<A HREF="../../../../com/trolltech/qt/QNativePointer.html" title="class in com.trolltech.qt">QNativePointer</A>&nbsp;nativePointer)</PRE>
<DL>
<DD>This function returns the QSemaphore instance pointed to by nativePointer
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>nativePointer</CODE> - the QNativePointer of which object should be returned.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/trolltech/qt/core/QRegExp.PatternSyntax.html" title="enum in com.trolltech.qt.core"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/trolltech/qt/core/QSettings.html" title="class in com.trolltech.qt.core"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?com/trolltech/qt/core/QSemaphore.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="QSemaphore.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;<A HREF="#nested_classes_inherited_from_class_com.trolltech.qt.QSignalEmitter">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

</BODY>
</HTML>