xine-lib  1.2.10
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 
27 typedef struct {
28  pthread_mutex_t lock;
29  void* object; /* referenced object */
30  void (*destructor)(void *); /* object destructor */
31  int count;
32 } refcounter_t;
33 
34 typedef void (*refcounter_destructor)(void*);
35 
37 
39 
41 
43 
44 #endif /* HAVE_REFCOUNTER_H */
refcounter_t
Definition: refcounter.h:27
refcounter_t::object
void * object
Definition: refcounter.h:29
refcounter_destructor
void(* refcounter_destructor)(void *)
Definition: refcounter.h:34
refcounter_t::count
int count
Definition: refcounter.h:31
attributes.h
refcounter_t::lock
pthread_mutex_t lock
Definition: refcounter.h:28
_x_refcounter_inc
int _x_refcounter_inc(refcounter_t *refcounter)
Definition: refcounter.c:49
_x_new_refcounter
refcounter_t * _x_new_refcounter(void *object, refcounter_destructor destructor)
Definition: refcounter.c:36
XINE_PROTECTED
#define XINE_PROTECTED
Definition: attributes.h:73
_x_refcounter_dispose
void _x_refcounter_dispose(refcounter_t *refcounter)
Definition: refcounter.c:76
_x_refcounter_dec
int _x_refcounter_dec(refcounter_t *refcounter)
Definition: refcounter.c:61