Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 7aa0b3689999b2d0524276a8f3c2a10a > files > 431

glibmm2.4-doc-2.42.0-3.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>glibmm: Glib::Dispatcher Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">glibmm
   &#160;<span id="projectnumber">2.42.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceGlib.html">Glib</a></li><li class="navelem"><a class="el" href="classGlib_1_1Dispatcher.html">Dispatcher</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classGlib_1_1Dispatcher-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Glib::Dispatcher Class Reference<div class="ingroups"><a class="el" href="group__Threads.html">Threads</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Signal class for inter-thread communication.  
 <a href="classGlib_1_1Dispatcher.html#details">More...</a></p>

<p><code>#include &lt;glibmm/dispatcher.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a1883255c63f36e1d218ccf3f1abfa992"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dispatcher.html#a1883255c63f36e1d218ccf3f1abfa992">Dispatcher</a> ()</td></tr>
<tr class="memdesc:a1883255c63f36e1d218ccf3f1abfa992"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create new <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> instance using the default main context.  <a href="#a1883255c63f36e1d218ccf3f1abfa992">More...</a><br /></td></tr>
<tr class="separator:a1883255c63f36e1d218ccf3f1abfa992"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a14692fe3e39140fc164cbd03149a7ce1"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dispatcher.html#a14692fe3e39140fc164cbd03149a7ce1">Dispatcher</a> (const <a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>&lt; <a class="el" href="classGlib_1_1MainContext.html">MainContext</a> &gt;&amp; context)</td></tr>
<tr class="memdesc:a14692fe3e39140fc164cbd03149a7ce1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create new <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> instance using an arbitrary main context.  <a href="#a14692fe3e39140fc164cbd03149a7ce1">More...</a><br /></td></tr>
<tr class="separator:a14692fe3e39140fc164cbd03149a7ce1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d220afa9063f8cf1364d5a1c73eb010"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dispatcher.html#a6d220afa9063f8cf1364d5a1c73eb010">~Dispatcher</a> ()</td></tr>
<tr class="separator:a6d220afa9063f8cf1364d5a1c73eb010"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07b89c90f931db118c8c184d0615ce92"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dispatcher.html#a07b89c90f931db118c8c184d0615ce92">emit</a> ()</td></tr>
<tr class="separator:a07b89c90f931db118c8c184d0615ce92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4610275deedf1324bf71afde1c8c71ea"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dispatcher.html#a4610275deedf1324bf71afde1c8c71ea">operator()</a> ()</td></tr>
<tr class="separator:a4610275deedf1324bf71afde1c8c71ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63645395ac79c03b5ec9e81d8099dea7"><td class="memItemLeft" align="right" valign="top"><a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1connection.html">sigc::connection</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dispatcher.html#a63645395ac79c03b5ec9e81d8099dea7">connect</a> (const <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt;&amp; slot)</td></tr>
<tr class="separator:a63645395ac79c03b5ec9e81d8099dea7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Signal class for inter-thread communication. </p>
<p><a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Glib::Dispatcher</a> works similar to sigc::signal&lt;void&gt;. But unlike normal signals, the notification happens asynchronously through a pipe. This is a simple and efficient way of communicating between threads, and especially useful in a thread model with a single GUI thread.</p>
<p>No mutex locking is involved, apart from the operating system's internal I/O locking. That implies some usage rules:</p>
<ul>
<li>Only one thread may connect to the signal and receive notification, but multiple senders are allowed even without locking. </li>
<li>The GLib main loop must run in the receiving thread (this will be the GUI thread usually). </li>
<li>The <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> object must be instantiated by the receiver thread. </li>
<li>The <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> object should be instantiated before creating any of the sender threads, if you want to avoid extra locking. </li>
<li>The <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> object must be deleted by the receiver thread. </li>
<li>All <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> objects instantiated by the same receiver thread must use the same main context.</li>
</ul>
<p>Notes about performance:</p>
<ul>
<li>After instantiation, <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Glib::Dispatcher</a> will never lock any mutexes on its own. The interaction with the GLib main loop might involve locking on the <em>receiver</em> side. The <em>sender</em> side, however, is guaranteed not to lock, except for internal locking in the <code>write()</code> system call. </li>
<li>All <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> instances of a receiver thread share the same pipe. That is, if you use <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Glib::Dispatcher</a> only to notify the GUI thread, only one pipe is created no matter how many <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> objects you have.</li>
</ul>
<p>Using <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Glib::Dispatcher</a> on Windows:</p>
<p><a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Glib::Dispatcher</a> also works on win32-based systems. Unfortunately though, the implementation cannot use a pipe on win32 and therefore does have to lock a mutex on emission, too. However, the impact on performance is likely minor and the notification still happens asynchronously. Apart from the additional lock the behavior matches the Unix implementation. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="thread_2dispatcher_8cc-example.html#_a3">thread/dispatcher.cc</a>.</dd>
</dl></div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a1883255c63f36e1d218ccf3f1abfa992"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Glib::Dispatcher::Dispatcher </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create new <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> instance using the default main context. </p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors. ">Glib::FileError</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a14692fe3e39140fc164cbd03149a7ce1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Glib::Dispatcher::Dispatcher </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>&lt; <a class="el" href="classGlib_1_1MainContext.html">MainContext</a> &gt;&amp;&#160;</td>
          <td class="paramname"><em>context</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Create new <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication. ">Dispatcher</a> instance using an arbitrary main context. </p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1FileError.html" title="Exception class for file-related errors. ">Glib::FileError</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a6d220afa9063f8cf1364d5a1c73eb010"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Glib::Dispatcher::~Dispatcher </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a63645395ac79c03b5ec9e81d8099dea7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1connection.html">sigc::connection</a> Glib::Dispatcher::connect </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt; &amp;&#160;</td>
          <td class="paramname"><em>slot</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a07b89c90f931db118c8c184d0615ce92"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::Dispatcher::emit </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a4610275deedf1324bf71afde1c8c71ea"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::Dispatcher::operator() </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Sep 22 2014 21:38:33 for glibmm by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.7
</small></address>
</body>
</html>