[asterisk-commits] branch bweschke/bug_6047 - r8229 in /team/bweschke/bug_6047: ./ channels/ inc...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 18 20:50:13 MST 2006


Author: bweschke
Date: Wed Jan 18 21:50:11 2006
New Revision: 8229

URL: http://svn.digium.com/view/asterisk?rev=8229&view=rev
Log:
 Code cleanup. Get the scheduler struct definitions back out of chan_sip.c


Modified:
    team/bweschke/bug_6047/channels/chan_sip.c
    team/bweschke/bug_6047/include/asterisk/sched.h
    team/bweschke/bug_6047/sched.c

Modified: team/bweschke/bug_6047/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/channels/chan_sip.c?rev=8229&r1=8228&r2=8229&view=diff
==============================================================================
--- team/bweschke/bug_6047/channels/chan_sip.c (original)
+++ team/bweschke/bug_6047/channels/chan_sip.c Wed Jan 18 21:50:11 2006
@@ -522,34 +522,6 @@
 	char *context;                  /*!< Context the hint is for */
 	char *exten;                    /*!< Extension the hint is for */
 	struct sip_pvt *p;              /*!< SIP Session Structure Ptr */
-};
-
-struct sched {
-	struct sched *next;             /* Next event in the list */
-	int id;                         /* ID number of event */
-	struct timeval when;            /* Absolute time event should take place */
-	int resched;                    /* When to reschedule */
-	int variable;                   /* Use return value from callback to reschedule */
-	void *data;                     /* Data */
-	ast_sched_cb callback;          /* Callback */
-};
-
-struct sched_context {
-	ast_mutex_t lock;
-	/* Number of events processed */
-	int eventcnt;
-
-	/* Number of outstanding schedule events */
-	int schedcnt;
-
-	/* Schedule entry and main queue */
-	struct sched *schedq;
-
-#ifdef SCHED_MAX_CACHE
-	/* Cache of unused schedule structures and how many */
-	struct sched *schedc;
-	int schedccnt;
-#endif
 };
 
 #define SIP_ALREADYGONE		(1 << 0)	/*!< Whether or not we've already been destroyed by our peer */

Modified: team/bweschke/bug_6047/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/include/asterisk/sched.h?rev=8229&r1=8228&r2=8229&view=diff
==============================================================================
--- team/bweschke/bug_6047/include/asterisk/sched.h (original)
+++ team/bweschke/bug_6047/include/asterisk/sched.h Wed Jan 18 21:50:11 2006
@@ -27,6 +27,8 @@
 extern "C" {
 #endif
 
+#include "asterisk/lock.h"
+
 /*! Max num of schedule structs */
 /*!
  * The max number of schedule structs to keep around
@@ -36,7 +38,42 @@
  */
 #define SCHED_MAX_CACHE 128
 
-struct sched_context;
+/*! callback for a cheops scheduler */
+/*! 
+ * A cheops scheduler callback takes a pointer with callback data and
+ * returns a 0 if it should not be run again, or non-zero if it should be
+ * rescheduled to run again
+ */
+typedef int (*ast_sched_cb)(void *data);
+#define AST_SCHED_CB(a) ((ast_sched_cb)(a))
+
+struct sched {
+        struct sched *next;             /* Next event in the list */
+        int id;                         /* ID number of event */
+        struct timeval when;            /* Absolute time event should take place */
+        int resched;                    /* When to reschedule */
+        int variable;                   /* Use return value from callback to reschedule */
+        void *data;                     /* Data */
+        ast_sched_cb callback;          /* Callback */
+};
+
+struct sched_context {
+        ast_mutex_t lock;
+        /* Number of events processed */
+        int eventcnt;
+
+        /* Number of outstanding schedule events */
+        int schedcnt;
+
+        /* Schedule entry and main queue */
+        struct sched *schedq;
+
+#ifdef SCHED_MAX_CACHE
+        /* Cache of unused schedule structures and how many */
+        struct sched *schedc;
+        int schedccnt;
+#endif
+};
 
 /*! New schedule context */
 /* !
@@ -52,15 +89,6 @@
  * Returns 0 on success, -1 on failure
  */
 void sched_context_destroy(struct sched_context *c);
-
-/*! callback for a cheops scheduler */
-/*! 
- * A cheops scheduler callback takes a pointer with callback data and
- * returns a 0 if it should not be run again, or non-zero if it should be
- * rescheduled to run again
- */
-typedef int (*ast_sched_cb)(void *data);
-#define AST_SCHED_CB(a) ((ast_sched_cb)(a))
 
 /*!Adds a scheduled event */
 /*! 

Modified: team/bweschke/bug_6047/sched.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_6047/sched.c?rev=8229&r1=8228&r2=8229&view=diff
==============================================================================
--- team/bweschke/bug_6047/sched.c (original)
+++ team/bweschke/bug_6047/sched.c Wed Jan 18 21:50:11 2006
@@ -48,34 +48,6 @@
 /* Determine if a is sooner than b */
 #define SOONER(a,b) (((b).tv_sec > (a).tv_sec) || \
 					 (((b).tv_sec == (a).tv_sec) && ((b).tv_usec > (a).tv_usec)))
-
-struct sched {
-	struct sched *next;		/* Next event in the list */
-	int id; 			/* ID number of event */
-	struct timeval when;		/* Absolute time event should take place */
-	int resched;			/* When to reschedule */
-	int variable;		/* Use return value from callback to reschedule */
-	void *data; 			/* Data */
-	ast_sched_cb callback;		/* Callback */
-};
-
-struct sched_context {
-	ast_mutex_t lock;
-	/* Number of events processed */
-	int eventcnt;
-
-	/* Number of outstanding schedule events */
-	int schedcnt;
-
-	/* Schedule entry and main queue */
- 	struct sched *schedq;
-
-#ifdef SCHED_MAX_CACHE
-	/* Cache of unused schedule structures and how many */
-	struct sched *schedc;
-	int schedccnt;
-#endif
-};
 
 struct sched_context *sched_context_create(void)
 {



More information about the asterisk-commits mailing list