It seems like the browser you are using has JavaScript disabled. As a result, the site will not function properly. We really want you to enable it so you may experience our site as we intended it. If you have no idea what we are talking about or if you need help, visit http://www.enable-javascript.com×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

Oops, it seems like you're using an old browser that we do not fully support. If you're able to, please upgrade your browser here.×
This website uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Find out more on our cookie page.×

signal()

Synopsis:

Since:

Arguments:

The signal number (defined in <signal.h>).
For more information, see
"
POSIX signals
"
in the documentation for SignalAction().

func

The function that you want to call when the signal is raised.

Library:

libc

Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.

Description:

The signal() function is used to specify an action to take place
when certain conditions are detected while a program executes.
See the <signal.h> header file for definitions of these
conditions, and also refer to the
System Architecture
manual.

In order to attach signal handlers to a process with a different real or effective user ID,
your process must have the
PROCMGR_AID_SIGNAL ability enabled.
For more information, see
procmgr_ability().

There are three types of actions that can be associated with a signal:
SIG_DFL, SIG_IGN or a pointer to a function.
Initially, all signals are set to
SIG_DFL or SIG_IGN prior to entry of the
main()
routine.
An action can be specified for each of the conditions, depending upon
the value of the func argument, as discussed below.

func is a function

When func is a function name, that function is called
in a manner equivalent to the following code sequence:

Call
longjmp()
or
siglongjmp().
If you use longjmp() to return from a signal handler, the signal remains masked.
You can use siglongjmp() to restore the mask to
the state saved in a previous call to sigsetjmp().

It isn't safe to use floating-point operations in signal handlers.

After returning from the signal-catching function, the receiving
process resumes execution at the point at which it was interrupted.

The signal catching function is described as follows:

void func( int sig_no )
{
…
}

It isn't possible to catch the SIGSTOP or SIGKILL signals.

Since signal-catching functions are invoked asynchronously with
process execution, you need to take into account the
same sort of things that you would in a multithreaded program when inspecting
or manipulating shared resources.

func is SIG_DFL

If func is SIG_DFL, the default action for the condition is taken.

If the default action is to stop the process, the execution of that process is temporarily suspended.
When a process stops, a SIGCHLD signal is generated for its parent process,
unless the parent process has set the SA_NOCLDSTOP flag (see
sigaction()).
While a process is stopped, any additional signals that are sent to
the process aren't delivered until the process is continued, except
SIGKILL, which always terminates the receiving process.

Setting a signal action to SIG_DFL for a signal that is pending,
and whose default action is to ignore the signal (for example,
SIGCHLD), causes the pending signal to be discarded,
whether or not it's blocked.

func is SIG_IGN

If func is SIG_IGN, the indicated condition is ignored.

You can't set the action for the SIGSTOP and
SIGKILL signals to SIG_IGN.

Setting a signal action to SIG_IGN for a signal that's pending
causes the pending signal to be discarded, whether or not it is blocked.

If a process sets the action for the SIGCHLD signal to
SIG_IGN,
its children won't enter the zombie state and the process can't use
wait()
or
waitpid()
to wait on their deaths.

Handling a condition

When a condition is detected, it may be handled by a program,
it may be ignored, or it may be handled by the usual default action
(often causing an error message to be printed on the stderr
stream followed by program termination).

A condition can be generated by a program using the
raise()
or
kill() function

Returns:

The previous value of func for the indicated condition, or
SIG_ERR if the request couldn't be handled
(errno
is set to EINVAL).

1. Download the tools

Before you start developing, you'll need to visit the Downloads tab. Here you'll find downloads for the BlackBerry 10 Native SDK, BlackBerry 10 Device Simulator, and some other useful tools.

2. Try the sample apps

Now featuring a filter control, the Sample apps tab allows you to search for samples by name or by feature.

Select either the Core or Cascades radio buttons to display the samples relevant to you.

3. Educate yourself

The Documentation tab contains tons of examples, tutorials, and best practices to guide you along the path towards building an awesome app.

You can access all the documentation that you need in the left-hand navigation.

4. Start developing

The Reference tab is where you'll find essential details about how to use our APIs.

You can use the left-hand navigation to choose how you would like to browse the reference: by module, by topic, or alphabetically. If you have an idea of what you are looking for, start typing it in the Filter box.