Name

lcb_timer_create — timer management

Synopsis

cc [ flag … ] file… -lcouchbase [ library … ]

#include <libcouchbase/couchbase.h>
lcb_timer_t lcb_timer_create(lcb_t instance,
                             const void *command_cookie,
                             lcb_uint32_t usec,
                             int periodic,
                             lcb_timer_callback callback,
                             lcb_error_t *error);
void lcb_timer_destroy(lcb_t instance, lcb_timer_t timer);

DESCRIPTION

These functions are used to create / destroy user defined timers.

The function lcb_timer_create() is used to create timer event associated with a certain instance of libcouchbase. When the timer expires the specified callback function will be called to notify the user. The command_cookie is passed to the timer function. All timers are relative to the current time, and specified in microseconds offset from the current time through the usec parameter. If periodic is set to a non-zero value the timer will reschedule itself when it expires. The status of the operation is returned through error. The lcb_timer_callback function with the following signature:

void function(lcb_timer_t timer,
              lcb_t instance,
              const void* cookie);

The lcb_timer_destroy() is used to destroy the specified timer. All non-periodic timers will be swept automatically. All timers will be swept when the connection instance will be destroyed. It is safe to call this function several gimes for given timer.

RETURN VALUES

lcb_timer_create() returns the newly created timer.

ATTRIBUTES

See lcb_attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE

Interface Stability

Committed

MT-Level

MT-Safe

COPYRIGHT

Copyright 2010-2013 Couchbase, Inc.

SEE ALSO

Learn more at http://www.couchbase.com/communities/c.

libcouchbase(3lib), lcb_create(3couchbase), lcb_attributes(5)