[Freeswitch-svn] [commit] r12299 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/su libsofia-sip-ua/su/sofia-sip
FreeSWITCH SVN
brian at freeswitch.org
Thu Feb 26 10:24:06 PST 2009
Author: brian
Date: Thu Feb 26 12:24:05 2009
New Revision: 12299
Log:
Tue Feb 3 10:31:33 CST 2009 Pekka Pessi <first.last at nokia.com>
* su_wait.h: added su_root_clone()
Modified:
freeswitch/trunk/libs/sofia-sip/.update
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_root.c
Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update (original)
+++ freeswitch/trunk/libs/sofia-sip/.update Thu Feb 26 12:24:05 2009
@@ -1 +1 @@
-Thu Feb 26 12:22:23 CST 2009
+Thu Feb 26 12:23:25 CST 2009
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h Thu Feb 26 12:24:05 2009
@@ -487,6 +487,9 @@
SOFIAPUBFUN int su_root_set_max_defer(su_root_t *, su_duration_t max_defer);
SOFIAPUBFUN su_duration_t su_root_get_max_defer(su_root_t const *self);
+SOFIAPUBFUN su_root_t *su_root_clone(su_root_t *root, su_root_magic_t *magic)
+ __attribute__((__malloc__));
+
/* Timers */
SOFIAPUBFUN su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
__attribute__((__malloc__));
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_root.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_root.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_root.c Thu Feb 26 12:24:05 2009
@@ -409,6 +409,48 @@
return su_root_create_with_port(magic, su_port_create());
}
+/* Initializer used by su_root_clone() */
+static int
+su_root_clone_initializer(su_root_t *root,
+ su_root_magic_t *magic)
+{
+ *(su_root_t **)magic = root;
+ return 0;
+}
+
+/** Create a a new root object sharing port/thread with existing one.
+ *
+ * Allocate and initialize the instance of su_root_t.
+ *
+ * @param magic pointer to user data
+ *
+ * @return A pointer to allocated su_root_t instance, NULL on error.
+ *
+ * @NEW_1_12_11
+ */
+su_root_t *
+su_root_clone(su_root_t *self, su_root_magic_t *magic)
+{
+ int threading = 0, error;
+ su_clone_r clone;
+ su_root_t *cloned = NULL;
+
+ if (self == NULL)
+ return NULL;
+
+ threading = self->sur_threading, self->sur_threading = 0;
+ error = su_clone_start(self, clone,
+ (void *)&cloned, su_root_clone_initializer, NULL);
+ self->sur_threading = threading;
+
+ if (error)
+ return NULL;
+
+ su_clone_forget(clone); /* destroyed with su_root_destroy() */
+ su_root_set_magic(cloned, magic);
+ return cloned;
+}
+
/**@internal
*
* Create a reactor object using given message port.
More information about the Freeswitch-svn
mailing list