mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 12:24:58 +00:00

These abstractions can be used to implement an efficient resource reference counter and simple mutual exclusion. On pthreads we use pthread_mutex_t, except when we are also on glibc and can directly use its asm/atomic.h definitions. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 lines
227 B
C
14 lines
227 B
C
#include "test_lib.h"
|
|
#include "common.h"
|
|
|
|
BEGIN_TEST(init_inc2_dec2_free)
|
|
git_refcnt p;
|
|
|
|
gitrc_init(&p);
|
|
gitrc_inc(&p);
|
|
gitrc_inc(&p);
|
|
must_be_true(!gitrc_dec(&p));
|
|
must_be_true(gitrc_dec(&p));
|
|
gitrc_free(&p);
|
|
END_TEST
|