libisdn
refcnt.h File Reference
#include <stdlib.h>
#include "common.h"

Go to the source code of this file.

Data Structures

struct  refcnt

Defines

#define refcnt_obj_ref(ptr, member)
#define refcnt_obj_unref(ptr, member)

Define Documentation

#define refcnt_obj_ref (   ptr,
  member 
)
Value:
({                                              \
                struct refcnt *__r = container_of(ptr, struct refcnt, member);  \
                ACCESS_ONCE(__r->nr_get)++;                                     \
                ptr;                                                            \
        })

Definition at line 37 of file refcnt.h.

#define refcnt_obj_unref (   ptr,
  member 
)
Value:
({                                      \
                struct refcnt *__r = container_of(ptr, struct refcnt, member);  \
                ACCESS_ONCE(__r->nr_get) - ++ACCESS_ONCE(__r->nr_put);          \
        })

Definition at line 43 of file refcnt.h.