Couchbase C Client  2.10.6
Asynchronous C Client for Couchbase
Destroying

Detailed Description

Library destruction routines.

Functions

void lcb_destroy (lcb_t instance)
 Destroy (and release all allocated resources) an instance of lcb. More...
 
lcb_destroy_callback lcb_set_destroy_callback (lcb_t, lcb_destroy_callback)
 Set the callback to be invoked when the instance is destroyed asynchronously. More...
 
void lcb_destroy_async (lcb_t instance, const void *arg)
 Asynchronously schedule the destruction of an instance. More...
 

Typedefs

typedef void(* lcb_destroy_callback) (const void *cookie)
 Callback received when instance is about to be destroyed. More...
 

Function Documentation

◆ lcb_destroy()

void lcb_destroy ( lcb_t  instance)

Destroy (and release all allocated resources) an instance of lcb.

Using instance after calling destroy will most likely cause your application to crash.

Note that any pending operations will not have their callbacks invoked.

Parameters
instancethe instance to destroy.
Stability
Committed:
Examples
example/analytics/analytics.c, example/crypto/openssl_symmetric_decrypt.c, example/crypto/openssl_symmetric_encrypt.c, example/fts/fts.c, example/libeventdirect/main.c, example/minimal/minimal.c, example/minimal/query.c, example/observe/durability.c, example/observe/observe.c, example/subdoc/subdoc-xattrs.c, example/tracing/tracing.c, and example/tracing/views.c.

◆ lcb_set_destroy_callback()

lcb_destroy_callback lcb_set_destroy_callback ( lcb_t  ,
lcb_destroy_callback   
)

Set the callback to be invoked when the instance is destroyed asynchronously.

Returns
the previous callback.

◆ lcb_destroy_async()

void lcb_destroy_async ( lcb_t  instance,
const void *  arg 
)

Asynchronously schedule the destruction of an instance.

This function provides a safe way for asynchronous environments to destroy the lcb_t handle without worrying about reentrancy issues.

Parameters
instance
arga pointer passed to the callback.

While the callback and cookie are optional, they are very much recommended for testing scenarios where you wish to ensure that all resources allocated by the instance have been closed. Specifically when the callback is invoked, all timers (save for the one actually triggering the destruction) and sockets will have been closed.

As with lcb_destroy() you may call this function only once. You may not call this function together with lcb_destroy as the two are mutually exclusive.

If for whatever reason this function is being called in a synchronous flow, lcb_wait() must be invoked in order for the destruction to take effect

See also
lcb_set_destroy_callback
Stability
Committed:

Typedef Documentation

◆ lcb_destroy_callback

typedef void(* lcb_destroy_callback) (const void *cookie)

Callback received when instance is about to be destroyed.

Parameters
cookiecookie passed to lcb_destroy_async()