xine-lib 1.2.13-20230125hg15249
refcounter.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-2018 the xine project
3 *
4 * This file is part of xine, a free video player.
5 *
6 * xine is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * xine is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 */
20#ifndef HAVE_REFCOUNTER_H
21#define HAVE_REFCOUNTER_H
22
23#include <pthread.h>
24
25#include <xine/attributes.h>
26
27typedef struct {
28 pthread_mutex_t lock;
29 void* object; /* referenced object */
30 void (*destructor)(void *); /* object destructor */
31 int count;
33
34typedef void (*refcounter_destructor)(void*);
35
37
39
41
43
44#endif /* HAVE_REFCOUNTER_H */
#define XINE_PROTECTED
Definition attributes.h:75
void(* refcounter_destructor)(void *)
Definition refcounter.h:34
void _x_refcounter_dispose(refcounter_t *refcounter)
Definition refcounter.c:78
int _x_refcounter_inc(refcounter_t *refcounter)
Definition refcounter.c:51
refcounter_t * _x_new_refcounter(void *object, refcounter_destructor destructor)
Definition refcounter.c:36
int _x_refcounter_dec(refcounter_t *refcounter)
Definition refcounter.c:63
Definition refcounter.h:27
void * object
Definition refcounter.h:29
int count
Definition refcounter.h:31
pthread_mutex_t lock
Definition refcounter.h:28