rx-prototypes-20080924
[openafs.git] / src / rx / rx_event.h
index 4907b51..cf8e6a4 100644 (file)
 #include "rx_clock.h"
 #endif /* KERNEL */
 
-/* An event is something that will happen at (or after) a specified clock time, unless cancelled prematurely.  The user routine (*func)() is called with arguments (event, arg, arg1) when the event occurs.  Warnings:  (1) The user supplied routine should NOT cause process preemption.   (2) The event passed to the user is still on the event queue at that time.  The user must not remove (event_Cancel) it explicitly, but the user may remove or schedule any OTHER event at this time. */
+/* An event is something that will happen at (or after) a specified clock 
+ * time, unless cancelled prematurely.  The user routine (*func)() is called 
+ * with arguments (event, arg, arg1) when the event occurs.  
+ * Warnings:  
+ *   (1) The user supplied routine should NOT cause process preemption.   
+ *   (2) The event passed to the user is still on the event queue at that 
+ *       time.  The user must not remove (event_Cancel) it explicitly, but 
+ *       the user may remove or schedule any OTHER event at this time. 
+ */
 
 struct rxevent {
     struct rx_queue junk;      /* Events are queued */
     struct clock eventTime;    /* When this event times out (in clock.c units) */
-    void (*func) ();           /* Function to call when this expires */
-    char *arg;                 /* Argument to the function */
-    char *arg1;                        /* Another argument */
+    union {
+       void (*oldfunc) (struct rxevent *, void *, void *); 
+       void (*newfunc) (struct rxevent *, void *, void *, int);
+    } func;                    /* Function to call when this expires */
+    void *arg;                 /* Argument to the function */
+    void *arg1;                        /* Another argument */
     int arg2;                  /* An integer argument */
     int newargs;               /* Nonzero if new-form arguments should be used */
 };
@@ -43,14 +54,20 @@ struct rxepoch {
     struct rx_queue events;    /* list of events for this epoch */
 };
 
-/* Some macros to make macros more reasonable (this allows a block to be used within a macro which does not cause if statements to screw up).   That is, you can use "if (...) macro_name(); else ...;" without having things blow up on the semi-colon. */
+/* Some macros to make macros more reasonable (this allows a block to be 
+ * used within a macro which does not cause if statements to screw up).   
+ * That is, you can use "if (...) macro_name(); else ...;" without 
+ * having things blow up on the semi-colon. */
 
 #ifndef BEGIN
 #define BEGIN do {
 #define END } while(0)
 #endif
 
-/* This routine must be called to initialize the event package.  nEvents is the number of events to allocate in a batch whenever more are needed.  If this is 0, a default number (10) will be allocated. */
+/* This routine must be called to initialize the event package.  
+ * nEvents is the number of events to allocate in a batch whenever 
+ * more are needed.  If this is 0, a default number (10) will be 
+ * allocated. */
 #if 0
 extern void rxevent_Init( /* nEvents, scheduler */ );
 #endif
@@ -60,12 +77,16 @@ extern void rxevent_Init( /* nEvents, scheduler */ );
 extern void exevent_NextEvent( /* when */ );
 #endif
 
-/* Arrange for the indicated event at the appointed time.  When is a "struct clock", in the clock.c time base */
+/* Arrange for the indicated event at the appointed time.  When is a 
+ * "struct clock", in the clock.c time base */
 #if 0
 extern struct rxevent *rxevent_Post( /* when, func, arg, arg1 */ );
 #endif
 
-/* Remove the indicated event from the event queue.  The event must be pending.  Also see the warning, above.  The event pointer supplied is zeroed. */
+/* Remove the indicated event from the event queue.  The event must be 
+ * pending.  Also see the warning, above.  The event pointer supplied 
+ * is zeroed. 
+ */
 #ifdef RX_ENABLE_LOCKS
 #ifdef RX_REFCOUNT_CHECK
 #define        rxevent_Cancel(event_ptr, call, type)                       \
@@ -94,7 +115,11 @@ extern struct rxevent *rxevent_Post( /* when, func, arg, arg1 */ );
        END
 #endif /* RX_ENABLE_LOCKS */
 
-/* The actions specified for each event that has reached the current clock time will be taken.  The current time returned by GetTime is used (warning:  this may be an old time if the user has not called clock_NewTime) */
+/* The actions specified for each event that has reached the current clock 
+ * time will be taken.  The current time returned by GetTime is used 
+ * (warning:  this may be an old time if the user has not called 
+ * clock_NewTime) 
+ */
 #if 0
 extern int rxevent_RaiseEvents();
 #endif