t8
1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
|
We inherit the reference counting mechanism from libsc. More...
Go to the source code of this file.
Macros | |
#define | t8_refcount_ref(rc) sc_refcount_ref(rc) |
Increase the reference count by one. More... | |
#define | t8_refcount_unref(rc) sc_refcount_unref(rc) |
Decrease the reference count by one. More... | |
#define | t8_refcount_is_active(rc) sc_refcount_is_active(rc) |
Query wether a reference counter is has a positive value. | |
#define | t8_refcount_is_last(rc) sc_refcount_is_last(rc) |
Query wether a reference counter has value one. | |
Typedefs | |
typedef sc_refcount_t | t8_refcount_t |
We can reuse the reference counter type from libsc. | |
Functions | |
void | t8_refcount_init (t8_refcount_t *rc) |
Initialize a reference counter to 1. More... | |
t8_refcount_t * | t8_refcount_new (void) |
Create a new reference counter with count initialized to 1. More... | |
void | t8_refcount_destroy (t8_refcount_t *rc) |
Destroy a reference counter that we allocated with t8_refcount_new. More... | |
We inherit the reference counting mechanism from libsc.
The only customization is to pass the package id of the t8code. This file is compatible with sc_refcount_ref and sc_refcount_unref.
#define t8_refcount_ref | ( | rc | ) | sc_refcount_ref(rc) |
Increase the reference count by one.
It is not necessary to duplicate this functionality as a function.
#define t8_refcount_unref | ( | rc | ) | sc_refcount_unref(rc) |
Decrease the reference count by one.
The count must be greater zero on input. If the reference count reaches zero, which is indicated by the return value, the counter may NOT be used furter with t8_refcount_ref or
[in] | rc | Reference counter |
void t8_refcount_destroy | ( | t8_refcount_t * | rc | ) |
Destroy a reference counter that we allocated with t8_refcount_new.
Its reference count must have decreased to zero.
[in,out] | rc | Allocated, formerly valid reference counter. |
void t8_refcount_init | ( | t8_refcount_t * | rc | ) |
Initialize a reference counter to 1.
It is legal if its status prior to this call is undefined.
[out] | rc | The reference counter is set to one by this call. |
t8_refcount_t* t8_refcount_new | ( | void | ) |
Create a new reference counter with count initialized to 1.
Equivalent to calling t8_refcount_init on a newly allocated refcount_t. It is mandatory to free this with t8_refcount_destroy.