refcount.h File Reference

Implements a locked reference counter. More...

#include <isc/atomic.h>
#include <isc/lang.h>
#include <isc/mutex.h>
#include <isc/platform.h>
#include <isc/types.h>
#include <isc/util.h>

Go to the source code of this file.

Data Structures

struct  isc_refcount

Defines

#define ISC_REFCOUNT_H   1
#define isc_refcount_destroy(rp)   REQUIRE((rp)->refs == 0)
#define isc_refcount_current(rp)   ((unsigned int)((rp)->refs))
#define isc_refcount_increment0(rp, tp)
#define isc_refcount_increment(rp, tp)
#define isc_refcount_decrement(rp, tp)

Typedefs

typedef ISC_LANG_BEGINDECLS
struct isc_refcount 
isc_refcount_t

Functions

isc_result_t isc_refcount_init (isc_refcount_t *ref, unsigned int n)


Detailed Description

Implements a locked reference counter.

These functions may actually be implemented using macros, and implementations of these macros are below. The isc_refcount_t type should not be accessed directly, as its contents depend on the implementation.

Definition in file refcount.h.


Define Documentation

#define ISC_REFCOUNT_H   1

Definition at line 21 of file refcount.h.

#define isc_refcount_destroy ( rp   )     REQUIRE((rp)->refs == 0)

Definition at line 192 of file refcount.h.

Referenced by _deref_prefix(), ATF_TC_BODY(), cfg_obj_destroy(), destroy(), destroy_iptable(), dns_acache_create(), dns_acl_match2(), dns_iptable_addprefix2(), dns_keynode_detach(), dns_order_detach(), dns_portlist_detach(), dns_rbtdb_create(), dns_rpz_detach_rpzs(), dns_rpz_new_zones(), dns_tsigkey_createfromkey(), dns_view_create(), dns_zone_create(), dst_key_free(), free_rbtdb(), load_zones(), nta_detach(), rpz_detach(), tsigkey_free(), view_loaded(), and zone_free().

#define isc_refcount_current ( rp   )     ((unsigned int)((rp)->refs))

Definition at line 193 of file refcount.h.

Referenced by _ref_prefix(), acache_cleaner_shutdown_action(), all_done(), cleanup_ring(), destroy(), detachnode(), end_cleaning(), exit_check(), maybe_free_rbtdb(), zone_free(), zone_iattach(), zone_idetach(), and zone_shutdown().

#define isc_refcount_increment0 ( rp,
tp   ) 

Value:

do {                                                            \
                unsigned int *_tmp = (unsigned int *)(tp);              \
                int _n = ++(rp)->refs;                                  \
                if (_tmp != NULL)                                       \
                        *_tmp = _n;                                     \
        } while (0)

Definition at line 195 of file refcount.h.

Referenced by closeversion(), and new_reference().

#define isc_refcount_increment ( rp,
tp   ) 

Value:

do {                                                            \
                unsigned int *_tmp = (unsigned int *)(tp);              \
                int _n;                                                 \
                REQUIRE((rp)->refs > 0);                                \
                _n = ++(rp)->refs;                                      \
                if (_tmp != NULL)                                       \
                        *_tmp = _n;                                     \
        } while (0)

Definition at line 203 of file refcount.h.

Referenced by _ref_prefix(), allrdatasets(), attach(), attachversion(), cfg_aclconfctx_attach(), cfg_obj_attach(), cfg_parser_attach(), closeversion(), currentversion(), dns_acache_attach(), dns_acache_attachentry(), dns_acl_attach(), dns_iptable_attach(), dns_keynode_attach(), dns_order_attach(), dns_portlist_attach(), dns_rpz_attach_rpzs(), dns_rpz_beginload(), dns_tsigkey_attach(), dns_tsigkey_find(), dns_tsigkeyring_add(), dns_view_attach(), dns_zone_attach(), dns_zone_link(), dst_key_attach(), isc_hash_ctxattach(), load_zones(), and nta_ref().

#define isc_refcount_decrement ( rp,
tp   ) 

Value:

do {                                                            \
                unsigned int *_tmp = (unsigned int *)(tp);              \
                int _n;                                                 \
                REQUIRE((rp)->refs > 0);                                \
                _n = --(rp)->refs;                                      \
                if (_tmp != NULL)                                       \
                        *_tmp = _n;                                     \
        } while (0)

Definition at line 213 of file refcount.h.

Referenced by _deref_prefix(), cfg_aclconfctx_detach(), cfg_obj_destroy(), cfg_parser_destroy(), cleanup_dead_nodes_callback(), closeversion(), decrement_reference(), detach(), dns_acache_create(), dns_acache_detach(), dns_acache_detachentry(), dns_acl_detach(), dns_iptable_detach(), dns_keynode_detach(), dns_order_detach(), dns_portlist_detach(), dns_rbtdb_create(), dns_rpz_detach_rpzs(), dns_rpz_new_zones(), dns_tsigkey_createfromkey(), dns_tsigkey_detach(), dns_zone_create(), dns_zone_detach(), dst_key_free(), free_rbtdb(), isc_hash_ctxdetach(), isc_hash_destroy(), load_zones(), nta_detach(), rpz_detach(), view_flushanddetach(), and view_loaded().


Typedef Documentation

typedef ISC_LANG_BEGINDECLS struct isc_refcount isc_refcount_t


Function Documentation

isc_result_t isc_refcount_init ( isc_refcount_t ref,
unsigned int  n 
)

Definition at line 28 of file refcount.c.

References isc_mutex_init, ISC_R_SUCCESS, and REQUIRE.

Referenced by _new_prefix(), allocate_version(), cfg_aclconfctx_create(), cfg_create_obj(), cfg_parser_create(), configure_rpz_zone(), dns_acache_create(), dns_acache_createentry(), dns_acl_create(), dns_iptable_create(), dns_keynode_create(), dns_order_create(), dns_portlist_create(), dns_rbtdb_create(), dns_rpz_new_zones(), dns_tsigkey_createfromkey(), dns_view_create(), dns_zone_create(), get_key_struct(), isc_hash_ctxcreate(), load_zones(), and nta_create().


Generated on Tue Apr 28 17:41:15 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha