1 #ifndef foopulsefdsemhfoo
2 #define foopulsefdsemhfoo
5 This file is part of PulseAudio.
7 Copyright 2004-2006 Lennart Poettering
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include <sys/types.h>
27 /* A simple, asynchronous semaphore which uses fds for sleeping. In
28 * the best case all functions are lock-free unless sleeping is
31 typedef struct pa_fdsem pa_fdsem
;
33 typedef struct pa_fdsem_data
{
35 pa_atomic_t signalled
;
39 pa_fdsem
*pa_fdsem_new(void);
40 pa_fdsem
*pa_fdsem_open_shm(pa_fdsem_data
*data
, int event_fd
);
41 pa_fdsem
*pa_fdsem_new_shm(pa_fdsem_data
*data
, int* event_fd
);
42 void pa_fdsem_free(pa_fdsem
*f
);
44 void pa_fdsem_post(pa_fdsem
*f
);
45 void pa_fdsem_wait(pa_fdsem
*f
);
46 int pa_fdsem_try(pa_fdsem
*f
);
48 int pa_fdsem_get(pa_fdsem
*f
);
50 int pa_fdsem_before_poll(pa_fdsem
*f
);
51 int pa_fdsem_after_poll(pa_fdsem
*f
);