source: roaraudio/include/libroar/scheduler.h @ 5694:d31d31565f84

Last change on this file since 5694:d31d31565f84 was 5694:d31d31565f84, checked in by phi, 12 years ago

small updates to scheduler API

File size: 3.4 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
52enum roar_scheduler_strategy {
53 ROAR_SCHEDULER_STRATEGY_DEFAULT = -1,
54 ROAR_SCHEDULER_STRATEGY_SELECT  =  1,
55 ROAR_SCHEDULER_STRATEGY_WAIT,
56 ROAR_SCHEDULER_STRATEGY_SELECTORWAIT,
57 ROAR_SCHEDULER_STRATEGY_WAITORSELECT,
58};
59
60#define ROAR_SCHEDULER_FLAG_DEFAULT -1
61#define ROAR_SCHEDULER_FLAG_NONE    0x0000
62#define ROAR_SCHEDULER_FLAG_FREE    0x0001
63
64struct roar_scheduler_source {
65 enum roar_scheduler_type type;
66 int flags;
67 struct roar_dl_lhandle * lhandle;
68 struct roar_vio_calls * vio;
69 int (*cb)(struct roar_scheduler_source * source, void * userdata, int eventsa);
70 void * userdata;
71 union {
72  void * vp; // dummy.
73  int eventsq;
74  struct roar_vio_selecttv timeout;
75  struct roar_plugincontainer * container;
76  struct {
77   int proto;
78   const struct roar_dl_proto * impl;
79   int client;
80   struct roar_buffer *obuffer;
81   void * userdata;
82   const struct roar_keyval * protopara;
83   ssize_t protoparalen;
84  } cpi;
85 } handle;
86};
87
88struct roar_scheduler;
89
90struct roar_scheduler * roar_scheduler_new(int flags, enum roar_scheduler_strategy strategy);
91int                     roar_scheduler_ref(struct roar_scheduler * sched);
92int                     roar_scheduler_unref(struct roar_scheduler * sched);
93
94int                     roar_scheduler_iterate(struct roar_scheduler * sched);
95int                     roar_scheduler_run(struct roar_scheduler * sched);
96
97int                     roar_scheduler_source_add(struct roar_scheduler * sched,
98                                                  struct roar_scheduler_source * source);
99int                     roar_scheduler_source_del(struct roar_scheduler * sched,
100                                                  struct roar_scheduler_source * source);
101
102#endif
103
104//ll
Note: See TracBrowser for help on using the repository browser.