Tue Feb 3 10:31:33 CST 2009 Pekka Pessi <first.last@nokia.com>
* su_wait.h: added su_root_clone() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12299 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
38abb2ced7
commit
d35ca59959
|
@ -1 +1 @@
|
||||||
Thu Feb 26 12:22:23 CST 2009
|
Thu Feb 26 12:23:25 CST 2009
|
||||||
|
|
|
@ -487,6 +487,9 @@ SOFIAPUBFUN int su_root_has_thread(su_root_t *root);
|
||||||
SOFIAPUBFUN int su_root_set_max_defer(su_root_t *, su_duration_t max_defer);
|
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_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 */
|
/* Timers */
|
||||||
SOFIAPUBFUN su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
|
SOFIAPUBFUN su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
|
||||||
__attribute__((__malloc__));
|
__attribute__((__malloc__));
|
||||||
|
|
|
@ -409,6 +409,48 @@ su_root_t *su_root_create(su_root_magic_t *magic)
|
||||||
return su_root_create_with_port(magic, su_port_create());
|
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
|
/**@internal
|
||||||
*
|
*
|
||||||
* Create a reactor object using given message port.
|
* Create a reactor object using given message port.
|
||||||
|
|
Loading…
Reference in New Issue