man-pages/man3/Glib::Signal.3pm.html
2021-03-31 01:06:50 +01:00

166 lines
4.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Glib::Signal</TITLE>
</HEAD><BODY>
<H1>Glib::Signal</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2020-02-18<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Glib::Signal - Object customization and general purpose notification
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
This page describes some functions related to signals in Glib. Since most
things you can do with signals are tied to Glib::Object instances, the
majority of the signal functions are documented there.
<A NAME="lbAD">&nbsp;</A>
<H3>Thread safety</H3>
Some libraries, most notably GStreamer, sometimes invoke signal handlers from a
foreign thread that has no Perl interpreter associated with it. When this
happens, we have no choice but to hand the marshalling over to the main loop
which in turn later wakes up the main thread and lets it handle the request.
We cannot invoke the signal handler from the foreign thread since the Perl
interpreter may not be used concurrently.
<P>
The downside to this approach is that the foreign thread is blocked until the
main thread has finished executing the signal handler. This might lead to
deadlocks. It might help in this case to wrap the crucial parts of the signal
handler inside a Glib::Idle callback so that the signal handler can return
directly.
<A NAME="lbAE">&nbsp;</A>
<H2>METHODS</H2>
<A NAME="lbAF">&nbsp;</A>
<H3>integer = Glib-&gt;<B>install_exception_handler</B> ($func, $data=undef)</H3>
<DL COMPACT>
<DT id="1">&bull;<DD>
<TT>$func</TT> (subroutine)
<DT id="2">&bull;<DD>
<TT>$data</TT> (scalar)
</DL>
<P>
Install a subroutine to be executed when a signal emission traps an exception
(a croak or die). <I></I>$func<I></I> should return boolean (true if the handler should
remain installed) and expect to receive a single scalar. This scalar will be a
private copy of $@ which the handler can mangle to its heart's content.
<P>
Returns an identifier that may be used with <TT>&quot;remove_exception_handler&quot;</TT>.
<P>
See <TT>&quot;gperl_install_exception_handler()&quot;</TT> in Glib::xsapi.
<A NAME="lbAG">&nbsp;</A>
<H3>Glib-&gt;<B>remove_exception_handler</B> ($tag)</H3>
<DL COMPACT>
<DT id="3">&bull;<DD>
<TT>$tag</TT> (integer)
</DL>
<P>
Remove the exception handler identified by <I></I>$tag<I></I>, as returned by
<TT>&quot;install_exception_handler&quot;</TT>. If <I></I>$tag<I></I> cannot be found, this
does nothing.
<P>
<FONT SIZE="-1">WARNING:</FONT> Do not call this function from within an exception handler.
If you want to remove your handler during its execution just have it
return false.
<P>
See <TT>&quot;gperl_remove_exception_handler()&quot;</TT> in Glib::xsapi.
<A NAME="lbAH">&nbsp;</A>
<H2>ENUMS AND FLAGS</H2>
<A NAME="lbAI">&nbsp;</A>
<H3>flags Glib::SignalFlags</H3>
<DL COMPACT>
<DT id="4">&bull;<DD>
'run-first' / 'G_SIGNAL_RUN_FIRST'
<DT id="5">&bull;<DD>
'run-last' / 'G_SIGNAL_RUN_LAST'
<DT id="6">&bull;<DD>
'run-cleanup' / 'G_SIGNAL_RUN_CLEANUP'
<DT id="7">&bull;<DD>
'no-recurse' / 'G_SIGNAL_NO_RECURSE'
<DT id="8">&bull;<DD>
'detailed' / 'G_SIGNAL_DETAILED'
<DT id="9">&bull;<DD>
'action' / 'G_SIGNAL_ACTION'
<DT id="10">&bull;<DD>
'no-hooks' / 'G_SIGNAL_NO_HOOKS'
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
Glib, Glib::Object
<A NAME="lbAK">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (C) 2003-2011 by the gtk2-perl team.
<P>
This software is licensed under the <FONT SIZE="-1">LGPL.</FONT> See Glib for a full notice.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="11"><A HREF="#lbAB">NAME</A><DD>
<DT id="12"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DL>
<DT id="13"><A HREF="#lbAD">Thread safety</A><DD>
</DL>
<DT id="14"><A HREF="#lbAE">METHODS</A><DD>
<DL>
<DT id="15"><A HREF="#lbAF">integer = Glib-&gt;<B>install_exception_handler</B> ($func, $data=undef)</A><DD>
<DT id="16"><A HREF="#lbAG">Glib-&gt;<B>remove_exception_handler</B> ($tag)</A><DD>
</DL>
<DT id="17"><A HREF="#lbAH">ENUMS AND FLAGS</A><DD>
<DL>
<DT id="18"><A HREF="#lbAI">flags Glib::SignalFlags</A><DD>
</DL>
<DT id="19"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="20"><A HREF="#lbAK">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:45 GMT, March 31, 2021
</BODY>
</HTML>