%kill() Function

For Windows: Not Supported

The %kill() function sends the signal specified in signal to the process pid.

Syntax

var = %kill(pid, signal)

Description

All D3 processes normally catch signals for their internal use. The built-in %pgetpid allows finding the PID of a process by knowing its port number (PIB). Only SIGUSR2 should be sent to a D3 process. Other signals are used internally and can cause problems if used out of context.

SIGTERM

Logs off the D3 process and disconnects it.

SIGHUP

Logs off the D3 process, but leaves it connected to the D3 virtual machine. This behavior can be modified by providing a user written signal handler.

SIGINT

Emulates pressing the BREAK key, possibly sending the D3 process to the debugger.

Signal numbers are defined in dm,bp,unix.h signal.h.

TIP

Signal numbers are very implementation specific. Use the symbols defined in the include file: signal.h.

 

WARNING

Sending a SIGKILL to an active D3 process can create data corruption.

Example(s)

* Get its pid, and send hangup (SIGHUP=1) to it.

pib=32

pid=%pgetpid(pib)

if %kill(pid, 1) = -1 then

print "Cannot logoff process ":pib

end

See Also

%pgetpid() Function, FlashBASIC C Functions Overview, cfunction Statement, kill Command, PID, pid Command, Port Number, trap Command