source: roaraudio/include/libroar/scheduler.h @ 6052:d48765b2475e

Last change on this file since 6052:d48765b2475e was 6052:d48765b2475e, checked in by phi, 9 years ago

updated copyright headers

File size: 3.7 KB
Line 
1//scheduler.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
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 // for future use.
51 ROAR_SCHEDULER_CONNECTION,
52 ROAR_SCHEDULER_VSS
53};
54
55enum roar_scheduler_strategy {
56 ROAR_SCHEDULER_STRATEGY_DEFAULT = -1,
57 ROAR_SCHEDULER_STRATEGY_SELECT  =  1,
58 ROAR_SCHEDULER_STRATEGY_WAIT,
59 ROAR_SCHEDULER_STRATEGY_SELECTORWAIT,
60 ROAR_SCHEDULER_STRATEGY_WAITORSELECT,
61};
62
63#define ROAR_SCHEDULER_FLAG_DEFAULT -1
64#define ROAR_SCHEDULER_FLAG_NONE    0x0000
65#define ROAR_SCHEDULER_FLAG_FREE    0x0001
66#define ROAR_SCHEDULER_FLAG_STUB    0x0002
67#define ROAR_SCHEDULER_FLAG_KEEP_RUNNING 0x0004 /* keep _run() running in case of no work */
68
69struct roar_scheduler_source {
70 enum roar_scheduler_type type;
71 int flags;
72 struct roar_dl_lhandle * lhandle;
73 struct roar_vio_calls * vio;
74 int (*cb)(struct roar_scheduler_source * source, void * userdata, int eventsa);
75 void * userdata;
76 union {
77  void * vp; // dummy.
78  int eventsq;
79  struct roar_vio_selecttv timeout;
80  struct roar_plugincontainer * container;
81  struct {
82   int proto;
83   const struct roar_dl_proto * impl;
84   int client;
85   struct roar_buffer *obuffer;
86   void * userdata;
87   const struct roar_keyval * protopara;
88   ssize_t protoparalen;
89  } cpi;
90  struct roar_connection * con;
91  roar_vs_t * vss;
92 } handle;
93};
94
95struct roar_scheduler;
96
97struct roar_scheduler * roar_scheduler_new(int flags, enum roar_scheduler_strategy strategy);
98int                     roar_scheduler_ref(struct roar_scheduler * sched);
99int                     roar_scheduler_unref(struct roar_scheduler * sched);
100
101int                     roar_scheduler_iterate(struct roar_scheduler * sched);
102int                     roar_scheduler_run(struct roar_scheduler * sched);
103
104int                     roar_scheduler_source_add(struct roar_scheduler * sched,
105                                                  struct roar_scheduler_source * source);
106int                     roar_scheduler_source_del(struct roar_scheduler * sched,
107                                                  struct roar_scheduler_source * source);
108
109#endif
110
111//ll
Note: See TracBrowser for help on using the repository browser.