5 * Copyright (C) Robert Ham 2002, 2003 (node@users.sourceforge.net)
7 * Modification for MLT:
8 * Copyright (C) 2004 Ushodaya Enterprises Limited
9 * Author: Dan Dennedy <dan@dennedy.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #ifndef __JLH_LOCK_FREE_FIFO_H__
27 #define __JLH_LOCK_FREE_FIFO_H__
29 /** lock free fifo ring buffer structure */
30 typedef struct lock_free_fifo
{
31 /** Size of the ringbuffer (in elements) */
33 /** the memory containing the ringbuffer */
35 /** the size of an element */
37 /** the current position of the reader */
38 unsigned int read_index
;
39 /** the current position of the writer */
40 unsigned int write_index
;
43 void lff_init (lff_t
* lff
, unsigned int size
, size_t object_size
);
44 void lff_free (lff_t
* lff
);
46 lff_t
* lff_new (unsigned int size
, size_t object_size
);
47 void lff_destroy (lff_t
* lock_free_fifo
);
49 int lff_read (lff_t
* lock_free_fifo
, void * data
);
50 int lff_write (lff_t
* lock_free_fifo
, void * data
);
53 #endif /* __JLH_LOCK_FREE_FIFO_H__ */