Jump to content

DosSendSignalException: Difference between revisions

From EDM2
Created page with "==Description== Sends a Ctrl+C or a Ctrl+Break signal exception to another process. ==Syntax== <PRE> #define INCL_DOSEXCEPTIONS #include <os2.h> PID pid; /* T..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
Sends a Ctrl+C or a Ctrl+Break signal exception to another process.
Sends a Ctrl+C or a Ctrl+Break signal exception to another process.  


==Syntax==
==Syntax==
<PRE>
DosSendSignalException(pid, exception)
#define INCL_DOSEXCEPTIONS
#include <os2.h>
 
PID      pid;        /*  The identification of the process that is to receive the signal exception. */
ULONG    exception;  /*  The number of the signal exception to send. */
APIRET    ulrc;      /*  Return Code. */


ulrc = DosSendSignalException(pid, exception);
</PRE>
==Parameters==
==Parameters==
;pid (PID) - input: The identification of the process that is to receive the signal exception.
;exception (ULONG) - input: The number of the signal exception to send.
:Possible values are shown in the following list:
::1  XCPT_SIGNAL_INTR
::4  XCPT_SIGNAL_BREAK


; pid (PID) - input :  The identification of the process that is to receive the signal exception.
==Returns==
 
;ulrc (APIRET) - returns: Return Code. DosSendSignalException returns one of the following values:
; exception (ULONG) - input :  The number of the signal exception to send.
:0 NO_ERROR
Possible values are shown in the following list:
:1 ERROR_INVALID_FUNCTION
 
:156 ERROR_SIGNAL_REFUSED
1      XCPT_SIGNAL_INTR
:205 ERROR_NO_SIGNAL_SENT
4      XCPT_SIGNAL_BREAK
:209 ERROR_INVALID_SIGNAL_NUMBER
 
:303 ERROR_INVALID_PROCID
; ulrc (APIRET) - returns: Return Code.
 
DosSendSignalException returns one of the following values:
 
0             NO_ERROR  
1             ERROR_INVALID_FUNCTION  
156           ERROR_SIGNAL_REFUSED  
205           ERROR_NO_SIGNAL_SENT  
209           ERROR_INVALID_SIGNAL_NUMBER  
303           ERROR_INVALID_PROCID  
 
For a full list of error codes, see Errors.


==Remarks==
==Remarks==
Line 41: Line 25:
DosSendSignalException sends either an XCPT_SIGNAL_INTR (Ctrl+C) or an XCPT_SIGNAL_BREAK (Ctrl+Break) signal exception to another process.
DosSendSignalException sends either an XCPT_SIGNAL_INTR (Ctrl+C) or an XCPT_SIGNAL_BREAK (Ctrl+Break) signal exception to another process.


For a detailed list of the system exceptions, select System Exceptions.  
For a detailed list of the system exceptions, select System Exceptions.


==Example Code==
==Example Code==
Line 78: Line 62:
   return NO_ERROR;
   return NO_ERROR;
}
}
</PRE>


</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosAcknowledgeSignalException|CPI:DosAcknowledgeSignalException]]
* [[DosAcknowledgeSignalException]]
* [[OS2 API:CPI:DosEnterMustComplete|CPI:DosEnterMustComplete]]
* [[DosEnterMustComplete]]
* [[OS2 API:CPI:DosExitMustComplete|CPI:DosExitMustComplete]]
* [[DosExitMustComplete]]
* [[OS2 API:CPI:DosRaiseException|CPI:DosRaiseException]]
* [[DosRaiseException]]
* [[OS2 API:CPI:DosSetExceptionHandler|CPI:DosSetExceptionHandler]]
* [[DosSetExceptionHandler]]
* [[OS2 API:CPI:DosSetSignalExceptionFocus|CPI:DosSetSignalExceptionFocus]]
* [[DosSetSignalExceptionFocus]]
* [[OS2 API:CPI:DosUnsetExceptionHandler|CPI:DosUnsetExceptionHandler]]
* [[DosUnsetExceptionHandler]]
* [[OS2 API:CPI:DosUnwindException|CPI:DosUnwindException]]
* [[DosUnwindException]]
 


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Latest revision as of 11:50, 26 June 2021

Sends a Ctrl+C or a Ctrl+Break signal exception to another process.

Syntax

DosSendSignalException(pid, exception)

Parameters

pid (PID) - input
The identification of the process that is to receive the signal exception.
exception (ULONG) - input
The number of the signal exception to send.
Possible values are shown in the following list:
1 XCPT_SIGNAL_INTR
4 XCPT_SIGNAL_BREAK

Returns

ulrc (APIRET) - returns
Return Code. DosSendSignalException returns one of the following values:
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
156 ERROR_SIGNAL_REFUSED
205 ERROR_NO_SIGNAL_SENT
209 ERROR_INVALID_SIGNAL_NUMBER
303 ERROR_INVALID_PROCID

Remarks

Do not make Presentation Manager calls from exception handlers.

DosSendSignalException sends either an XCPT_SIGNAL_INTR (Ctrl+C) or an XCPT_SIGNAL_BREAK (Ctrl+Break) signal exception to another process.

For a detailed list of the system exceptions, select System Exceptions.

Example Code

This example sends a signal exception to another process.

#define INCL_DOSPROCESS     /* Process and thread values */
#define INCL_DOSEXCEPTIONS  /* DOS exception values      */
#define INCL_DOSERRORS      /* DOS error values          */
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(USHORT argc, CHAR *argv[] ) {

   APIRET      rc          = NO_ERROR; /* Return code                        */
   PID         pidToIntr   = 0;        /* Interrupt this process             */

   if ( argc < 2 ) {
      printf("sendsig error:  Need to pass PID of thread to interrupt.\n");
      return 1;
   } else {
      pidToIntr = (PID) atoi ( argv[1] );
   } /* endif */

   rc = DosSendSignalException ( pidToIntr,            /* Process to interrupt */
                                 XCPT_SIGNAL_INTR );   /* Send this signal     */

   if (rc != NO_ERROR) {
      printf("DosSendSignalException error: return code = %u\n", rc);
      return 1;
   } else {
      printf ("DosSendSignalException complete.\n");
   } /* endif */

   return NO_ERROR;
}

Related Functions