libspandsp 0.0.4
|
00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * schedule.h 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2004 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 * 00025 * $Id: schedule.h,v 1.16 2008/04/17 14:27:00 steveu Exp $ 00026 */ 00027 00028 /*! \file */ 00029 00030 /*! \page schedule_page Scheduling 00031 \section schedule_page_sec_1 What does it do? 00032 ???. 00033 00034 \section schedule_page_sec_2 How does it work? 00035 ???. 00036 */ 00037 00038 #if !defined(_SPANDSP_SCHEDULE_H_) 00039 #define _SPANDSP_SCHEDULE_H_ 00040 00041 typedef struct span_sched_state_s span_sched_state_t; 00042 00043 typedef void (*span_sched_callback_func_t)(span_sched_state_t *s, void *user_data); 00044 00045 /*! A scheduled event entry. */ 00046 typedef struct 00047 { 00048 uint64_t when; 00049 span_sched_callback_func_t callback; 00050 void *user_data; 00051 } span_sched_t; 00052 00053 /*! A scheduled event queue. */ 00054 struct span_sched_state_s 00055 { 00056 uint64_t ticker; 00057 int allocated; 00058 int max_to_date; 00059 span_sched_t *sched; 00060 logging_state_t logging; 00061 }; 00062 00063 #if defined(__cplusplus) 00064 extern "C" 00065 { 00066 #endif 00067 00068 uint64_t span_schedule_next(span_sched_state_t *s); 00069 uint64_t span_schedule_time(span_sched_state_t *s); 00070 00071 int span_schedule_event(span_sched_state_t *s, int us, span_sched_callback_func_t function, void *user_data); 00072 void span_schedule_update(span_sched_state_t *s, int us); 00073 void span_schedule_del(span_sched_state_t *s, int id); 00074 00075 span_sched_state_t *span_schedule_init(span_sched_state_t *s); 00076 int span_schedule_release(span_sched_state_t *s); 00077 00078 #if defined(__cplusplus) 00079 } 00080 #endif 00081 00082 #endif 00083 /*- End of file ------------------------------------------------------------*/