---
name: "tickit_watch_signal"
section: "3"
platform: "linux"
package: "libtickit-dev"
version: "0.4.3-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/tickit_watch_signal"
---

# tickit\_watch\_signal(3)

invoke a callback when a POSIX signal is raised

## NAME

tickit\_watch\_signal - invoke a callback when a POSIX signal is raised

## SYNOPSIS

```
#include <tickit.h>

typedef int TickitCallbackFn(Tickit *t, TickitEventflags flags,
    void *info, void *user);

void *tickit_watch_signal(Tickit *t, int signum, TickitBindFlags flags,
    TickitCallbackFn *fn, void *user);
```

Link with *-ltickit*.

## DESCRIPTION

**tickit\_watch\_signal**() registers a callback function to be invoked by the toplevel event loop when a POSIX signal is received by the process. A registered callback will be invoked by a running call to [**tickit\_run**(3)](/tickit_run/3.md). The callback function may be invoked more than once, if the signal is received multiple times. The *info* pointer will be **NULL**.

Multiple registrations may be made for the same signal number; when that signal is received all of them will be invoked in the order they exist in the queue. If registered with the **TICKIT\_BIND\_FIRST** flag, the callback will be inserted at the start of the queue, coming before others. If not, it is appended at the end.

If cancelled by [**tickit\_watch\_cancel**(3)](/tickit_watch_cancel/3.md) the callback function is invoked with just the **TICKIT\_EV\_UNBIND** flag if it had been registered with **TICKIT\_BIND\_UNBIND**.

## RETURN VALUE

**tickit\_watch\_signal**() returns an opaque identifier pointer.

## SEE ALSO

[**tickit\_new\_stdio**(3)](/tickit_new_stdio/3.md), [**tickit\_watch\_io**(3)](/tickit_watch_io/3.md), [**tickit\_watch\_timer\_after\_msec**(3)](/tickit_watch_timer_after_msec/3.md), [**tickit\_watch\_timer\_at\_epoch**(3)](/tickit_watch_timer_at_epoch/3.md), [**tickit\_watch\_later**(3)](/tickit_watch_later/3.md), [**tickit\_watch\_process**(3)](/tickit_watch_process/3.md), [**tickit\_watch\_cancel**(3)](/tickit_watch_cancel/3.md), [**tickit**(7)](/tickit/7.md)
