User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:xatmi:tpext_addperiodcb.3

tpext_addperiodcb

Name

tpext_addperiodcb — XATMI extension, periodic callback function add

Synopsis

#include <atmi.h>

int tpext_addperiodcb(int secs, int (*p_periodcb)(void));

Link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm

DESCRIPTION

This is periodic callback function which is set for Enduro/X servers. Function is called every secs seconds while XATMI server is in state of waiting next service call (during the message poll). The callback function p_periodcb in case of success shall return 0. If callback function returns non 0 value, then XATMI server will proceed with shutdown. The interval is not guaranteed. If the service is doing some work currently then it will not be interrupted. If the service workload was longer than period, then given period will be lost and will be called once timeout exceeded in next sleep period or after receiving next service call.

If NULL value is passed to p_periodcb, then poller is disabled. How ever it is recommend to set secs to 0 too. Or use tpext_delperiodcb() for this.

This function is available only for XATMI servers.

RETURN VALUE

On success, tpext_addperiodcb() return zero; on error, -1 is returned, with tperrno set to indicate the error.

ERRORS

At current version, function always succeeds.

EXAMPLE

See atmitest/test008_extensions/atmisv.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd