[svn-commits] russell: branch group/timing r122528 - /team/group/timing/res/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 13 08:04:39 CDT 2008


Author: russell
Date: Fri Jun 13 08:04:38 2008
New Revision: 122528

URL: http://svn.digium.com/view/asterisk?view=rev&rev=122528
Log:
add skeleton for a timing module that uses the pthread API for timing

Added:
    team/group/timing/res/res_timing_pthread.c   (with props)

Added: team/group/timing/res/res_timing_pthread.c
URL: http://svn.digium.com/view/asterisk/team/group/timing/res/res_timing_pthread.c?view=auto&rev=122528
==============================================================================
--- team/group/timing/res/res_timing_pthread.c (added)
+++ team/group/timing/res/res_timing_pthread.c Fri Jun 13 08:04:38 2008
@@ -1,0 +1,106 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2008, Digium, Inc.
+ *
+ * Russell Bryant <russell at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! 
+ * \file
+ * \author Russell Bryant <russell at digium.com>
+ *
+ * Timing logic shamelessly stolen from bridge_softmix, by Joshua Colp.
+ *
+ * \brief pthread timing interface 
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
+
+#include <math.h>
+
+#include "asterisk/module.h"
+#include "asterisk/timing.h"
+#include "asterisk/utils.h"
+
+static void *timing_funcs_handle;
+
+static int pthread_timer_open(void);
+static void pthread_timer_close(int handle);
+static int pthread_timer_set_rate(int handle, unsigned int rate);
+static void pthread_timer_ack(int handle, unsigned int quantity);
+static int pthread_timer_enable_continuous(int handle);
+static int pthread_timer_disable_continuous(int handle);
+static enum ast_timing_event pthread_timer_get_event(int handle);
+
+static struct ast_timing_functions pthread_timing_functions = {
+	.timer_open = pthread_timer_open,
+	.timer_close = pthread_timer_close,
+	.timer_set_rate = pthread_timer_set_rate,
+	.timer_ack = pthread_timer_ack,
+	.timer_enable_continuous = pthread_timer_enable_continuous,
+	.timer_disable_continuous = pthread_timer_disable_continuous,
+	.timer_get_event = pthread_timer_get_event,
+};
+
+static int pthread_timer_open(void)
+{
+	return 0;
+}
+
+static void pthread_timer_close(int handle)
+{
+}
+
+static int pthread_timer_set_rate(int handle, unsigned int rate)
+{
+	return 0;
+}
+
+static void pthread_timer_ack(int handle, unsigned int quantity)
+{
+}
+
+static int pthread_timer_enable_continuous(int handle)
+{
+	return 0;
+}
+
+static int pthread_timer_disable_continuous(int handle)
+{
+	return 0;
+}
+
+static enum ast_timing_event pthread_timer_get_event(int handle)
+{
+	return 0;
+}
+
+static int load_module(void)
+{
+	return (timing_funcs_handle = ast_install_timing_functions(&pthread_timing_functions)) ?
+		AST_MODULE_LOAD_SUCCESS : AST_MODULE_LOAD_DECLINE;
+}
+
+static int unload_module(void)
+{
+	/* ast_uninstall_timing_functions(timing_funcs_handle); */
+
+	/* This module can not currently be unloaded.  No use count handling is being done. */
+
+	return -1;
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "pthread Timing Interface");

Propchange: team/group/timing/res/res_timing_pthread.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/timing/res/res_timing_pthread.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/timing/res/res_timing_pthread.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the svn-commits mailing list