📄 gclosure.sgml
字号:
</entry></row><row><entry align="right"><parameter>n_param_values</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>param_values</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>invocation_hint</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>marshal_data</parameter> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GClosureNotify">GClosureNotify ()</title><programlisting>void (*GClosureNotify) (<link linkend="gpointer">gpointer</link> data, <link linkend="GClosure">GClosure</link> *closure);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>data</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>closure</parameter> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GClosureNotifyData">struct GClosureNotifyData</title><programlisting>struct GClosureNotifyData{ gpointer data; GClosureNotify notify;};</programlisting><para></para></refsect2><refsect2><title><anchor id="g-cclosure-new">g_cclosure_new ()</title><programlisting><link linkend="GClosure">GClosure</link>* g_cclosure_new (<link linkend="GCallback">GCallback</link> callback_func, <link linkend="gpointer">gpointer</link> user_data, <link linkend="GClosureNotify">GClosureNotify</link> destroy_data);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>callback_func</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>user_data</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>destroy_data</parameter> :</entry><entry></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-cclosure-new-swap">g_cclosure_new_swap ()</title><programlisting><link linkend="GClosure">GClosure</link>* g_cclosure_new_swap (<link linkend="GCallback">GCallback</link> callback_func, <link linkend="gpointer">gpointer</link> user_data, <link linkend="GClosureNotify">GClosureNotify</link> destroy_data);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>callback_func</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>user_data</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>destroy_data</parameter> :</entry><entry></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-cclosure-new-object">g_cclosure_new_object ()</title><programlisting><link linkend="GClosure">GClosure</link>* g_cclosure_new_object (<link linkend="GCallback">GCallback</link> callback_func, <link linkend="GObject">GObject</link> *object);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>callback_func</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>object</parameter> :</entry><entry></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-cclosure-new-object-swap">g_cclosure_new_object_swap ()</title><programlisting><link linkend="GClosure">GClosure</link>* g_cclosure_new_object_swap (<link linkend="GCallback">GCallback</link> callback_func, <link linkend="GObject">GObject</link> *object);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>callback_func</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>object</parameter> :</entry><entry></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-closure-new-object">g_closure_new_object ()</title><programlisting><link linkend="GClosure">GClosure</link>* g_closure_new_object (<link linkend="guint">guint</link> sizeof_closure, <link linkend="GObject">GObject</link> *object);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>sizeof_closure</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>object</parameter> :</entry><entry></entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-closure-ref">g_closure_ref ()</title><programlisting><link linkend="GClosure">GClosure</link>* g_closure_ref (<link linkend="GClosure">GClosure</link> *closure);</programlisting><para>Increment the reference count on a closure to force it stayingalive while the caller holds a pointer to it.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>closure</parameter> :</entry><entry><link linkend="GClosure">GClosure</link> to increment the reference count on</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>The <parameter>closure</parameter> passed in, for convenience</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-closure-sink">g_closure_sink ()</title><programlisting>void g_closure_sink (<link linkend="GClosure">GClosure</link> *closure);</programlisting><para>Take over the initial ownership of a closure.When closures are newly created, they get an initial reference countof 1, eventhough no caller has yet invoked <link linkend="g-closure-ref">g_closure_ref</link>() on the <parameter>closure</parameter>.Code entities that store closures for notification purposes are supposedto call this function, for example like this:<msgtext><programlisting>static GClosure *notify_closure = NULL;voidfoo_notify_set_closure (GClosure *closure){ if (notify_closure) g_closure_unref (notify_closure); notify_closure = closure; if (notify_closure) { g_closure_ref (notify_closure); g_closure_sink (notify_closure); }}</programlisting></msgtext>Because <link linkend="g-closure-sink">g_closure_sink</link>() may decrement the reference count of a closure(if it hasn't been called on <parameter>closure</parameter> yet) just like <link linkend="g-closure-unref">g_closure_unref</link>(),<link linkend="g-closure-ref">g_closure_ref</link>() should be called prior to this function.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>closure</parameter> :</entry><entry><link linkend="GClosure">GClosure</link> to decrement the initial reference count on, if it's still being held</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-closure-unref">g_closure_unref ()</title><programlisting>void g_closure_unref (<link linkend="GClosure">GClosure</link> *closure);</programlisting><para>Decrement the reference count of a closure after it waspreviously incremented by the same caller. The closurewill most likely be destroyed and freed after this functionreturns.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>closure</parameter> :</entry><entry><link linkend="GClosure">GClosure</link> to decrement the reference count on</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-closure-invoke">g_closure_invoke ()</title><programlisting>void g_closure_invoke (<link linkend="GClosure">GClosure</link> *closure, <link linkend="GValue">GValue</link> *return_value, <link linkend="guint">guint</link> n_param_values, const <link linkend="GValue">GValue</link> *param_values, <link linkend="gpointer">gpointer</link> invocation_hint);</programlisting><para></para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>closure</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>return_value</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>n_param_values</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>param_values</parameter> :</entry><entry></entry></row><row><entry align="right"><parameter>invocation_hint</parameter> :</entry><entry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -