<!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.11"/> <title>glibmm: Glib::SignalIdle 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" /> <link href="doxygen-extra.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 id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">glibmm  <span id="projectnumber">2.60.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related 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 List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class 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_1SignalIdle.html">SignalIdle</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="classGlib_1_1SignalIdle-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">Glib::SignalIdle Class Reference<div class="ingroups"><a class="el" href="group__MainLoop.html">The Main Event Loop</a></div></div> </div> </div><!--header--> <div class="contents"> <p><code>#include <glibmm/main.h></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:ac8befbaf1d10a17d1f3f75143e967a3f"><td class="memItemLeft" align="right" valign="top"><a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1connection.html">sigc::connection</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1SignalIdle.html#ac8befbaf1d10a17d1f3f75143e967a3f">connect</a> (const <a class="elRef" href="../../../libsigc++-2.0/reference/html/classsigc_1_1slot.html">sigc::slot</a>< bool >& slot, int priority=<a class="el" href="namespaceGlib.html#a0c450f82b9e34689e2dda2038ba7834fae8c1127af0a2dab71f196a957dab8375">PRIORITY_DEFAULT_IDLE</a>)</td></tr> <tr class="memdesc:ac8befbaf1d10a17d1f3f75143e967a3f"><td class="mdescLeft"> </td><td class="mdescRight">Connects an idle handler. <a href="#ac8befbaf1d10a17d1f3f75143e967a3f">More...</a><br /></td></tr> <tr class="separator:ac8befbaf1d10a17d1f3f75143e967a3f"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a94217dc63e35f96b5cee4c48f2cdd020"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1SignalIdle.html#a94217dc63e35f96b5cee4c48f2cdd020">connect_once</a> (const <a class="elRef" href="../../../libsigc++-2.0/reference/html/classsigc_1_1slot.html">sigc::slot</a>< void >& slot, int priority=<a class="el" href="namespaceGlib.html#a0c450f82b9e34689e2dda2038ba7834fae8c1127af0a2dab71f196a957dab8375">PRIORITY_DEFAULT_IDLE</a>)</td></tr> <tr class="memdesc:a94217dc63e35f96b5cee4c48f2cdd020"><td class="mdescLeft"> </td><td class="mdescRight">Connects an idle handler that runs only once. <a href="#a94217dc63e35f96b5cee4c48f2cdd020">More...</a><br /></td></tr> <tr class="separator:a94217dc63e35f96b5cee4c48f2cdd020"><td class="memSeparator" colspan="2"> </td></tr> </table> <h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="ac8befbaf1d10a17d1f3f75143e967a3f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1connection.html">sigc::connection</a> Glib::SignalIdle::connect </td> <td>(</td> <td class="paramtype">const <a class="elRef" href="../../../libsigc++-2.0/reference/html/classsigc_1_1slot.html">sigc::slot</a>< bool > & </td> <td class="paramname"><em>slot</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>priority</em> = <code><a class="el" href="namespaceGlib.html#a0c450f82b9e34689e2dda2038ba7834fae8c1127af0a2dab71f196a957dab8375">PRIORITY_DEFAULT_IDLE</a></code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Connects an idle handler. </p> <div class="fragment"><div class="line"><span class="keywordtype">bool</span> idle_handler() { ... }</div><div class="line"><a class="code" href="group__MainLoop.html#ga76792522d9680a05e232d3519a25f98d">Glib::signal_idle</a>().<a class="code" href="classGlib_1_1SignalIdle.html#ac8befbaf1d10a17d1f3f75143e967a3f">connect</a>(<a class="codeRef" href="../../../libsigc++-2.0/reference/html/group__ptr__fun.html#ga9c80de72f656fb05e81fda622dddc863">sigc::ptr_fun</a>(& idle_handler));</div></div><!-- fragment --><p> is equivalent to: </p><div class="fragment"><div class="line"><span class="keywordtype">bool</span> idle_handler() { ... }</div><div class="line"><span class="keyword">const</span> <span class="keyword">auto</span> idle_source = <a class="code" href="classGlib_1_1IdleSource.html#a2d60b73fff1919fb0b9022a4d9a0b148">Glib::IdleSource::create</a>();</div><div class="line">idle_source->connect(<a class="codeRef" href="../../../libsigc++-2.0/reference/html/group__ptr__fun.html#ga9c80de72f656fb05e81fda622dddc863">sigc::ptr_fun</a>(& idle_handler));</div><div class="line">idle_source->attach(<a class="code" href="classGlib_1_1MainContext.html#a1502cbed045a9fb27d18c6975e1d255d">Glib::MainContext::get_default</a>());</div></div><!-- fragment --><p>This method is not thread-safe. You should call it, or manipulate the returned <a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1connection.html">sigc::connection</a> object, only from the thread where the <a class="el" href="classGlib_1_1SignalIdle.html">SignalIdle</a> object's <a class="el" href="classGlib_1_1MainContext.html" title="Main context. ">MainContext</a> runs.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">slot</td><td>A slot to call when the main loop is idle. If <code>idle_handler()</code> returns <code>false</code> the handler is disconnected. </td></tr> <tr><td class="paramname">priority</td><td>The priority of the new event source. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>A connection handle, which can be used to disconnect the handler. </dd></dl> </div> </div> <a class="anchor" id="a94217dc63e35f96b5cee4c48f2cdd020"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Glib::SignalIdle::connect_once </td> <td>(</td> <td class="paramtype">const <a class="elRef" href="../../../libsigc++-2.0/reference/html/classsigc_1_1slot.html">sigc::slot</a>< void > & </td> <td class="paramname"><em>slot</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>priority</em> = <code><a class="el" href="namespaceGlib.html#a0c450f82b9e34689e2dda2038ba7834fae8c1127af0a2dab71f196a957dab8375">PRIORITY_DEFAULT_IDLE</a></code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Connects an idle handler that runs only once. </p> <p>This method takes a function pointer to a function with a void return and no parameters. After running once it is not called again.</p> <p>Because <a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1trackable.html">sigc::trackable</a> is not thread-safe, if the slot represents a non-static method of a class deriving from <a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1trackable.html">sigc::trackable</a>, and the slot is created by <a class="elRef" href="../../../libsigc++-2.0/reference/html/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>, <a class="el" href="classGlib_1_1SignalIdle.html#a94217dc63e35f96b5cee4c48f2cdd020" title="Connects an idle handler that runs only once. ">connect_once()</a> should only be called from the thread where the <a class="el" href="classGlib_1_1SignalIdle.html">SignalIdle</a> object's <a class="el" href="classGlib_1_1MainContext.html" title="Main context. ">MainContext</a> runs. You can use, say, boost::bind() or, in C++11, <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01513.html#ga7b2eddb726568256e49824ad01a05099">std::bind()</a> or a C++11 lambda expression instead of <a class="elRef" href="../../../libsigc++-2.0/reference/html/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>.</p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="classGlib_1_1SignalIdle.html#ac8befbaf1d10a17d1f3f75143e967a3f" title="Connects an idle handler. ">connect()</a> </dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">slot</td><td>A slot to call when the main loop is idle. For example: <div class="fragment"><div class="line"><span class="keywordtype">void</span> on_idle_once()</div></div><!-- fragment --> </td></tr> <tr><td class="paramname">priority</td><td>The priority of the new event source. </td></tr> </table> </dd> </dl> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="thread_2dispatcher_8cc-example.html#a19">thread/dispatcher.cc</a>.</dd> </dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Mar 19 2019 09:56:46 for glibmm by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>