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

cyclic.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: cyclic.h,v 1.9 2003/01/05 14:29:54 grubba Exp $
00006 */
00007 
00008 #ifndef CYCLIC_H
00009 #define CYCLIC_H
00010 
00011 #include "pike_error.h"
00012 #include "threads.h"
00013 
00014 /* #define CYCLIC_DEBUG */
00015 
00016 typedef struct CYCLIC
00017 {
00018   ONERROR onerr;
00019   void *th;
00020   char *id;
00021   void *a,*b;
00022   void *ret;
00023   struct CYCLIC *next;
00024 } CYCLIC;
00025 
00026 
00027 #ifdef CYCLIC_DEBUG
00028 
00029 #define DECLARE_CYCLIC()                                                \
00030   static char cyclic_identifier__[] = __FILE__ ":" DEFINETOSTR(__LINE__); \
00031   CYCLIC cyclic_struct__
00032 #define BEGIN_CYCLIC(A,B) \
00033    begin_cyclic(&cyclic_struct__, cyclic_identifier__, \
00034                 THREAD_T_TO_PTR(th_self()), (void *)(A), (void *)(B))
00035 
00036 #else  /* CYCLIC_DEBUG */
00037 
00038 #define DECLARE_CYCLIC()           \
00039   static char cyclic_identifier__; \
00040   CYCLIC cyclic_struct__
00041 #define BEGIN_CYCLIC(A,B) \
00042    begin_cyclic(&cyclic_struct__, &cyclic_identifier__, \
00043                 THREAD_T_TO_PTR(th_self()), (void *)(A), (void *)(B))
00044 
00045 #endif  /* !CYCLIC_DEBUG */
00046 
00047 #define SET_CYCLIC_RET(RET) \
00048    cyclic_struct__.ret=(void *)(RET)
00049 
00050 #define END_CYCLIC()  unlink_cyclic(&cyclic_struct__)
00051 
00052 /* Prototypes begin here */
00053 void unlink_cyclic(CYCLIC *c);
00054 void *begin_cyclic(CYCLIC *c,
00055                    char *id,
00056                    void *thread,
00057                    void *a,
00058                    void *b);
00059 /* Prototypes end here */
00060 
00061 #endif /* CYCLIC_H */

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