Name

lcb_behavior_get_syncmode — Get the synchronous mode

Synopsis

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

#include <libcouchbase/couchbase.h>
lcb_syncmode_t lcb_behavior_get_syncmode(lcb_t instance);
void lcb_behavior_set_syncmode(lcb_t instance, lcb_syncmode_t mode);

DESCRIPTION

This interface deprecated and will be removed in libcouchbase 3.x in favour lcb_cntl(3couchbase). Consider this replacement:

1) for lcb_behavior_get_syncmode(instance):

lcb_syncmode_t mode;
lcb_cntl(LCB_CNTL_GET, instance, LCB_CNTL_SYNCMODE, &mode);

2) for lcb_behavior_set_syncmode(instance, mode):

lcb_cntl(LCB_CNTL_SET, instance, LCB_CNTL_SYNCMODE, &mode);

lcb_behavior_get_syncmode() returns the current synchronous mode the instance of libcouchbase operates in.

lcb_behavior_set_syncmode() specifies the synchronous mode the instance shall operate in.

Synchronous models

The following synchronous models are defined:

LCB_ASYNCHRONOUS    This is the default and all calls to libcouchbase
                    are non-blocking (except for lcb_wait().
LCB_SYNCHRONOUS     In synchronous mode the function will block until
                    either the operation is complete, or a hard
                    error occurs. Operating in synchronous mode
                    is the same as calling lcb_wait() after each
                    function call.

RETURN VALUES

lcb_behavior_get_syncmode() returns current mode the library operates in.

EXAMPLES

The following example shows how to toggle synchronous mode on and off

#include <libcouchbase/couchbase.h>
...
lcb_behavior_set_syncmode(instance, LCB_SYNCHRONOUS);
lcb_make_http_request( ... );
lcb_behavior_set_syncmode(instance, LCB_ASYNCHRONOUS);
...

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_wait(3couchbase), lcb_attributes(5), lcb_cntl(3couchbase)