Symbian3/PDK/Source/GUID-66C1493D-5B85-558A-9A39-454E6EBA307B.dita
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
equal deleted inserted replaced
2:ebc84c812384 3:46218c8b8afa
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept id="GUID-66C1493D-5B85-558A-9A39-454E6EBA307B" xml:lang="en"><title>Signal
    12 <concept id="GUID-66C1493D-5B85-558A-9A39-454E6EBA307B" xml:lang="en"><title>Signal
    13 Emulation on Symbian Platform</title><prolog><metadata><keywords/></metadata></prolog><conbody>
    13 Emulation on the Symbian Platform</title><prolog><metadata><keywords/></metadata></prolog><conbody>
    14 <p>The <codeph>libc</codeph> library of P.I.P.S. provides support for POSIX
    14 <p>The <codeph>libc</codeph> library of P.I.P.S. provides support for POSIX
    15 signals, thereby facilitating the porting of applications that use signals
    15 signals, thereby facilitating the porting of applications that use signals
    16 for exception handling and as control IPC. </p>
    16 for exception handling and as control IPC. </p>
    17 <p>P.I.P.S. supports POSIX signals by emulating them in user-side code. This
    17 <p>P.I.P.S. supports POSIX signals by emulating them in user-side code. This
    18 is different from the UNIX architecture, where the kernel manages the generation
    18 is different from the UNIX architecture, where the kernel manages the generation
    27 is done to mirror the UNIX behaviour of process execution being suspended
    27 is done to mirror the UNIX behaviour of process execution being suspended
    28 when a signal is being handled. </p> </li>
    28 when a signal is being handled. </p> </li>
    29 <li id="GUID-177E6544-106B-5E8B-94C6-B0AAD6437C4C"><p>There might be a considerable
    29 <li id="GUID-177E6544-106B-5E8B-94C6-B0AAD6437C4C"><p>There might be a considerable
    30 amount of latency when you send or receive signals. </p> </li>
    30 amount of latency when you send or receive signals. </p> </li>
    31 </ul>
    31 </ul>
    32 <section><title>Sending signals</title> <p>Signals can be sent between P.I.P.S.
    32 <section id="GUID-BD44C679-553C-402B-AF78-8922E15884E4"><title>Sending signals</title> <p>Signals can be sent between P.I.P.S.
    33 processes using <xref href="GUID-16DC4A9D-44BC-36E2-AB97-5E9E7521937D.dita"><apiname>kill()</apiname></xref>, <xref href="GUID-EB7F74AE-091B-32C3-9D73-18B82F8D3D73.dita"><apiname>raise()</apiname></xref> or <xref href="GUID-3C70BF0B-CD6E-3A30-A9E6-4CCF11D47EEC.dita"><apiname>sigqueue()</apiname></xref>. </p> <p>You
    33 processes using <xref href="GUID-16DC4A9D-44BC-36E2-AB97-5E9E7521937D.dita"><apiname>kill()</apiname></xref>, <xref href="GUID-EB7F74AE-091B-32C3-9D73-18B82F8D3D73.dita"><apiname>raise()</apiname></xref> or <xref href="GUID-3C70BF0B-CD6E-3A30-A9E6-4CCF11D47EEC.dita"><apiname>sigqueue()</apiname></xref>. </p> <p>You
    34 can use these functions to send any of the supported signals (refer to the
    34 can use these functions to send any of the supported signals (refer to the
    35 following table). </p> <p>The P.I.P.S. runtime sends the following signals
    35 following table). </p> <p>The P.I.P.S. runtime sends the following signals
    36 to P.I.P.S. processes: </p> <ul>
    36 to P.I.P.S. processes: </p> <ul>
    37 <li id="GUID-6F1D5A0A-4562-55B4-8E70-BAFF45F3EFA9"><p> <b>SIGPIPE:</b> This
    37 <li id="GUID-6F1D5A0A-4562-55B4-8E70-BAFF45F3EFA9"><p> <b>SIGPIPE:</b> This
    42 signal is sent to a process when an alarm registered by the process times
    42 signal is sent to a process when an alarm registered by the process times
    43 out. </p> </li>
    43 out. </p> </li>
    44 </ul> <p> <b>Note:</b> Always ensure that you handle <codeph>SIGPIPE</codeph>, <codeph>SIGCHLD</codeph> or <codeph>SIGALRM</codeph> using
    44 </ul> <p> <b>Note:</b> Always ensure that you handle <codeph>SIGPIPE</codeph>, <codeph>SIGCHLD</codeph> or <codeph>SIGALRM</codeph> using
    45 a signal handler to avoid the termination of the process receiving these signals.
    45 a signal handler to avoid the termination of the process receiving these signals.
    46 For more information about handling signals, see the following section. </p> </section>
    46 For more information about handling signals, see the following section. </p> </section>
    47 <section><title>Handling signals</title> <p>A signal can be received by a
    47 <section id="GUID-E244317F-3B69-4B10-8156-03F4A807E663"><title>Handling signals</title> <p>A signal can be received by a
    48 process at any time and is handled immediately, unless it is currently blocked.
    48 process at any time and is handled immediately, unless it is currently blocked.
    49 You can handle a signal in the following ways: </p> <ol id="GUID-F03B299F-A527-5365-81D3-DDDC607A4094">
    49 You can handle a signal in the following ways: </p> <ol id="GUID-F03B299F-A527-5365-81D3-DDDC607A4094">
    50 <li id="GUID-DF0E70C8-74C2-5ACC-B556-8D216275C554"><p> <b>Use default handling:</b> The
    50 <li id="GUID-DF0E70C8-74C2-5ACC-B556-8D216275C554"><p> <b>Use default handling:</b> The
    51 default action for each signal supported on Symbian platform is listed in
    51 default action for each signal supported on the Symbian platform
    52 the following table. </p> <p> <b>Note:</b> The default action for all of the
    52 is listed in the following table. </p> <p> <b>Note:</b> The default action
    53 signals sent by the P.I.P.S. runtime (<codeph>SIGPIPE</codeph>, <codeph>SIGCHLD</codeph> or <codeph>SIGALRM</codeph>)
    53 for all of the signals sent by the P.I.P.S. runtime (<codeph>SIGPIPE</codeph>, <codeph>SIGCHLD</codeph> or <codeph>SIGALRM</codeph>)
    54 is process termination. You must provide a custom handler for each of these
    54 is process termination. You must provide a custom handler for each of these
    55 signals. </p> <table id="GUID-7101041B-CC50-5367-A3A2-6D15FB15C3DD">
    55 signals. </p> <table id="GUID-7101041B-CC50-5367-A3A2-6D15FB15C3DD">
    56 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
    56 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
    57 <thead>
    57 <thead>
    58 <row>
    58 <row>
   228     signal(SIGCHLD,sighandler);
   228     signal(SIGCHLD,sighandler);
   229     // program logic
   229     // program logic
   230     return 0;
   230     return 0;
   231     }</codeblock> </li>
   231     }</codeblock> </li>
   232 </ol> </section>
   232 </ol> </section>
   233 <section><title>Blocking signals</title> <p>A P.I.P.S. process can choose
   233 <section id="GUID-252E0621-51F1-443A-A4FC-689BD27597E3"><title>Blocking signals</title> <p>A P.I.P.S. process can choose
   234 to block (and subsequently unblock) signals to itself using <xref href="GUID-02901E24-3615-3018-AF20-F5D5D63FD708.dita"><apiname>sighold()</apiname></xref>, <xref href="GUID-AE4CC3C8-C6D4-3F5C-A28F-C4AAB63E8992.dita"><apiname>sigset()</apiname></xref>, <xref href="GUID-68BD2914-FB73-3D91-9D81-425BF2436473.dita"><apiname>sigrelse()</apiname></xref> and <xref href="GUID-C7279C75-CB98-3F24-ABAA-76CF0009A8ED.dita"><apiname>sigprocmask()</apiname></xref>. Signals that are blocked on a P.I.P.S.
   234 to block (and subsequently unblock) signals to itself using <xref href="GUID-02901E24-3615-3018-AF20-F5D5D63FD708.dita"><apiname>sighold()</apiname></xref>, <xref href="GUID-AE4CC3C8-C6D4-3F5C-A28F-C4AAB63E8992.dita"><apiname>sigset()</apiname></xref>, <xref href="GUID-68BD2914-FB73-3D91-9D81-425BF2436473.dita"><apiname>sigrelse()</apiname></xref> and <xref href="GUID-C7279C75-CB98-3F24-ABAA-76CF0009A8ED.dita"><apiname>sigprocmask()</apiname></xref>. Signals that are blocked on a P.I.P.S.
   235 process are not be delivered for handling. Instead, they are queued to be
   235 process are not be delivered for handling. Instead, they are queued to be
   236 handled when they are unblocked. </p> <p>Non-realtime signals are queued only
   236 handled when they are unblocked. </p> <p>Non-realtime signals are queued only
   237 once, even when they are delivered multiple times. However, real-time signals
   237 once, even when they are delivered multiple times. However, real-time signals
   238 are queued every time they are delivered. </p> <p> <b> Note:</b> You can force
   238 are queued every time they are delivered. </p> <p> <b> Note:</b> You can force