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