Main Page | Class List | Directories | File List | Class Members | File Members

callback.h

Go to the documentation of this file.
00001 /*
00002 || This file is part of Pike. For copyright information see COPYRIGHT.
00003 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
00004 || for more information.
00005 || $Id: callback.h,v 1.19 2005/04/08 16:54:19 grubba Exp $
00006 */
00007 
00008 #ifndef CALLBACK_H
00009 #define CALLBACK_H
00010 
00011 #include "array.h"
00012 
00013 struct callback;
00014 
00015 struct callback_list
00016 {
00017   struct callback *callbacks;
00018   int num_calls;
00019 };
00020 
00021 extern struct callback_list fork_child_callback;
00022 
00023 typedef void (*callback_func)(struct callback *, void *,void *);
00024 
00025 #include "block_alloc_h.h"
00026 /* Prototypes begin here */
00027 struct callback;
00028 BLOCK_ALLOC(callback, CALLBACK_CHUNK);
00029 PMOD_EXPORT void low_call_callback(struct callback_list *lst, void *arg);
00030 PMOD_EXPORT struct callback *debug_add_to_callback(struct callback_list *lst,
00031                                                    callback_func call,
00032                                                    void *arg,
00033                                                    callback_func free_func);
00034 PMOD_EXPORT void *remove_callback(struct callback *l);
00035 void free_callback_list(struct callback_list *lst);
00036 void cleanup_callbacks(void);
00037 /* Prototypes end here */
00038 
00039 #define add_to_callback(LST,CALL,ARG,FF) \
00040   dmalloc_touch(struct callback *,debug_add_to_callback((LST),(CALL),(ARG),(FF)))
00041 
00042 #if 1
00043 #define call_callback(LST, ARG) do {                    \
00044   struct callback_list *lst_=(LST);                     \
00045   void *arg_=(ARG);                                     \
00046   if(lst_->callbacks) low_call_callback(lst_, arg_);    \
00047 }while(0)
00048 #else
00049 #define call_callback(LST, ARG) low_call_callback((LST), (ARG))
00050 #endif
00051 
00052 #endif

Generated on Fri Jul 22 23:44:24 2005 for Pike by  doxygen 1.3.9.1