source: roaraudio/include/libroar/scheduler.h @ 5692:0480fc56e68a

Last change on this file since 5692:0480fc56e68a was 5692:0480fc56e68a, checked in by phi, 12 years ago

Added scheduler (mainly for IO events) (Closes: #206)

File size: 3.1 KB
Line 
1//scheduler.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012
5 *
6 *  This file is part of libroar a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  libroar is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 *  NOTE for everyone want's to change something and send patches:
25 *  read README and HACKING! There a addition information on
26 *  the license of this document you need to read before you send
27 *  any patches.
28 *
29 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
30 *  or libpulse*:
31 *  The libs libroaresd, libroararts and libroarpulse link this lib
32 *  and are therefore GPL. Because of this it may be illigal to use
33 *  them with any software that uses libesd, libartsc or libpulse*.
34 */
35
36#ifndef _LIBROARSCHEDULER_H_
37#define _LIBROARSCHEDULER_H_
38
39#include "libroar.h"
40
41enum roar_scheduler_type {
42 ROAR_SCHEDULER_NONE = 0,
43 ROAR_SCHEDULER_VIO,
44 ROAR_SCHEDULER_TIMEOUT,
45 ROAR_SCHEDULER_PLUGIN,
46 ROAR_SCHEDULER_PLUGINCONTAINER,
47 ROAR_SCHEDULER_CPI_LISTEN,
48 ROAR_SCHEDULER_CPI_CLIENT,
49 ROAR_SCHEDULER_CPI_SERVICE // listen for CPI registrations.
50};
51
52#define ROAR_SCHEDULER_FLAG_NONE    0x0000
53#define ROAR_SCHEDULER_FLAG_FREE    0x0001
54
55struct roar_scheduler_source {
56 enum roar_scheduler_type type;
57 int flags;
58 struct roar_dl_lhandle * lhandle;
59 struct roar_vio_calls * vio;
60 int (*cb)(struct roar_scheduler_source * source, void * userdata, int eventsa);
61 void * userdata;
62 union {
63  void * vp; // dummy.
64  int eventsq;
65  struct roar_vio_selecttv timeout;
66  struct roar_plugincontainer * container;
67  struct {
68   int proto;
69   const struct roar_dl_proto * impl;
70   int client;
71   struct roar_buffer *obuffer;
72   void * userdata;
73   const struct roar_keyval * protopara;
74   ssize_t protoparalen;
75  } cpi;
76 } handle;
77};
78
79struct roar_scheduler;
80
81struct roar_scheduler * roar_scheduler_new(void);
82int                     roar_scheduler_ref(struct roar_scheduler * sched);
83int                     roar_scheduler_unref(struct roar_scheduler * sched);
84
85int                     roar_scheduler_iterate(struct roar_scheduler * sched);
86int                     roar_scheduler_run(struct roar_scheduler * sched);
87
88int                     roar_scheduler_source_add(struct roar_scheduler * sched,
89                                                  struct roar_scheduler_source * source);
90int                     roar_scheduler_source_del(struct roar_scheduler * sched,
91                                                  struct roar_scheduler_source * source);
92
93#endif
94
95//ll
Note: See TracBrowser for help on using the repository browser.