2 * (C) 2008 by Holger Hans Peter Freyther <zecke@selfish.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <osmocore/timer.h>
24 #include <osmocore/select.h>
26 #include "../../config.h"
28 static void timer_fired(void *data);
30 static struct timer_list timer_one = {
35 static struct timer_list timer_two = {
40 static struct timer_list timer_three = {
45 static void timer_fired(void *_data)
47 unsigned long data = (unsigned long) _data;
48 printf("Fired timer: %lu\n", data);
51 bsc_schedule_timer(&timer_one, 3, 0);
52 bsc_del_timer(&timer_two);
53 } else if (data == 2) {
54 printf("Should not be fired... bug in del_timer\n");
55 } else if (data == 3) {
56 printf("Timer fired not registering again\n");
58 printf("wtf... wrong data\n");
62 int main(int argc, char** argv)
64 printf("Starting... timer\n");
66 bsc_schedule_timer(&timer_one, 3, 0);
67 bsc_schedule_timer(&timer_two, 5, 0);
68 bsc_schedule_timer(&timer_three, 4, 0);
70 #ifdef HAVE_SYS_SELECT_H
75 printf("Select not supported on this platform!\n");