refcount man page on FreeBSD

Man page or keyword search:  
man Server   9747 pages
apropos Keyword Search (all sections)
Output format
FreeBSD logo
[printable version]

REFCOUNT(9)		 BSD Kernel Developer's Manual		   REFCOUNT(9)

NAME
     refcount, refcount_init, refcount_acquire, refcount_release — manage a
     simple reference counter

SYNOPSIS
     #include <sys/param.h>
     #include <sys/refcount.h>

     void
     refcount_init(volatile u_int *count, u_int value);

     void
     refcount_acquire(volatile u_int *count);

     int
     refcount_release(volatile u_int *count);

DESCRIPTION
     The refcount functions provide an API to manage a simple reference
     counter.  The caller provides the storage for the counter in an unsigned
     integer.  A pointer to this integer is passed via count.  Usually the
     counter is used to manage the lifetime of an object and is stored as a
     member of the object.

     The refcount_init() function is used to set the initial value of the
     counter to value.	It is normally used when creating a reference-counted
     object.

     The refcount_acquire() function is used to acquire a new reference.  The
     caller is responsible for ensuring that it holds a valid reference while
     obtaining a new reference.	 For example, if an object is stored on a list
     and the list holds a reference on the object, then holding a lock that
     protects the list provides sufficient protection for acquiring a new ref‐
     erence.

     The refcount_release() function is used to release an existing reference.
     The function returns a non-zero value if the reference being released was
     the last reference; otherwise, it returns zero.

     Note that these routines do not provide any inter-CPU synchronization,
     data protection, or memory ordering guarantees except for managing the
     counter.  The caller is responsible for any additional synchronization
     needed by consumers of any containing objects.  In addition, the caller
     is also responsible for managing the life cycle of any containing objects
     including explicitly releasing any resources when the last reference is
     released.

RETURN VALUES
     The refcount_release function returns non-zero when releasing the last
     reference and zero when releasing any other reference.

HISTORY
     These functions were introduced in FreeBSD 6.0.

BSD			       January 20, 2009				   BSD
[top]

List of man pages available for FreeBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
...................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net