Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

tim.h

Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 2005 by Kevin L. Mitchell <klmitch@mit.edu>
00003 **
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 **
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 **
00018 ** @(#)$Id: tim.h,v 1.10 2005/12/29 04:33:58 klmitch Exp $
00019 */
00020 #ifndef __include_event_tim_h__
00021 #define __include_event_tim_h__
00022 
00054 #ifndef __EVENT_LIBRARY__
00055 # include <event/event.h>
00056 #endif /* __EVENT_LIBRARY__ */
00057 
00058 #include <sys/time.h> /* struct timeval needed */
00059 
00060 EV_BEGIN_C_DECLS
00061 
00066 typedef struct _ev_tim_s ev_tim_t;
00067 
00074 typedef struct _ev_timnode_s _ev_timnode_t;
00075 
00081 typedef enum {
00082   TT_ABSOLUTE,          
00083   TT_RELATIVE,          
00084   TT_PERIODIC           
00085 } ev_timtype_t;
00086 
00092 struct _ev_timnode_s {
00093   ev_tim_t             *tn_parent;      
00094   ev_tim_t             *tn_next;        
00095   ev_tim_t             *tn_prev;        
00096   ev_tim_t             *tn_left;        
00097   ev_tim_t             *tn_right;       
00098 };
00099 
00105 struct _ev_tim_s {
00106   ev_genhdr_t           ti_hdr;         
00107   _ev_timnode_t         ti_node;        
00108   ev_timtype_t          ti_type;        
00109   struct timeval        ti_value;       
00110   struct timeval        ti_expire;      
00111 };
00112 
00117 #define EV_TIM_MAGIC 0x23a989d4
00118 
00131 #define ti_verify(tim)          eg_verify((tim), EV_TIM_MAGIC)
00132 
00142 #define ti_type(tim)            ((tim)->ti_type)
00143 
00155 #define ti_value(tim)           (&((tim)->ti_value))
00156 
00168 #define ti_expire(tim)          (&((tim)->ti_expire))
00169 
00199 extern ev_err_t timer_create(ev_ctx_t *ctx, ev_timtype_t type,
00200                              struct timeval *value, ev_call_t call, void *data,
00201                              ev_tim_t **tim_p)
00202      _gca_nonnull((1, 3));
00203 
00226 extern ev_err_t timer_resched(ev_ctx_t *ctx, ev_tim_t *tim, ev_timtype_t type,
00227                               struct timeval *value)
00228      _gca_nonnull((1, 2, 4));
00229 
00243 extern ev_err_t timer_destroy(ev_ctx_t *ctx, ev_tim_t *tim)
00244      _gca_nonnull((1, 2));
00245 
00246 EV_END_C_DECLS
00247 
00250 #endif /* __include_event_tim_h */

Generated on Wed Dec 28 23:36:56 2005 for event by  doxygen 1.4.4