DC_DEVICE_SET_CANCEL(3)

DC_DEVICE_SET_CANCEL(3) | Library Functions Manual | DC_DEVICE_SET_CANCEL(3)

# NAME

`dc_device_set_cancel` —
callback to check whether processing should cancel

# LIBRARY

library “libdivecomputer”

# SYNOPSIS

`#include <libdivecomputer/device.h>`

typedef int
`(*dc_cancel_callback_t)`(void *userdata);

dc_status_t
`dc_device_set_cancel`(dc_device_t *device, dc_cancel_callback_t callback, void *userdata);

# DESCRIPTION

Provide a function that the underlying device will periodically call to see if it should cancel its processing. The callback will return zero if the operation should not be cancelled, one if it should be cancelled.

The callback usually checks a value that is set during a signal handling callback. For example, one can invoke signal(3) to a function that sets a volatile sig_atomic_t value checked by the callback handler.

# RETURN VALUES

Returns `DC_STATUS_UNSUPPORTED` if the device is `NULL`, or `DC_STATUS_SUCCESS` otherwise.

# SEE ALSO

dc_device_open(3)

# AUTHORS

The library “libdivecomputer” library was written by Jef Driesen, jef@libdivecomputer.org. These manpages were written by
Kristaps Dzonsons, kristaps@bsd.lv.

January 5, 2017 | NetBSD 10.0