mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
Wed Jan 28 12:07:02 CST 2009 Pekka Pessi <first.last@nokia.com>
* su: added API functions su_timer_is_set() and su_timer_latest() git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11853 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -97,8 +97,6 @@ static void su_source_incref(su_port_t *self, char const *who);
|
||||
static void su_source_decref(su_port_t *self, int blocking, char const *who);
|
||||
static struct _GSource *su_source_gsource(su_port_t *port);
|
||||
|
||||
static int su_source_send(su_port_t *self, su_msg_r rmsg);
|
||||
|
||||
static int su_source_register(su_port_t *self,
|
||||
su_root_t *root,
|
||||
su_wait_t *wait,
|
||||
@@ -126,6 +124,8 @@ static int su_source_add_prepoll(su_port_t *port,
|
||||
static int su_source_remove_prepoll(su_port_t *port,
|
||||
su_root_t *root);
|
||||
static int su_source_multishot(su_port_t *self, int multishot);
|
||||
static int su_source_wakeup(su_port_t *self);
|
||||
static int su_source_is_running(su_port_t *self);
|
||||
|
||||
static char const *su_source_name(su_port_t const *self);
|
||||
|
||||
@@ -141,7 +141,7 @@ su_port_vtable_t const su_source_port_vtable[1] =
|
||||
|
||||
su_source_gsource,
|
||||
|
||||
su_source_send,
|
||||
su_base_port_send,
|
||||
su_source_register,
|
||||
su_source_unregister,
|
||||
su_source_deregister,
|
||||
@@ -162,6 +162,10 @@ su_port_vtable_t const su_source_port_vtable[1] =
|
||||
su_base_port_start_shared,
|
||||
su_base_port_wait,
|
||||
NULL,
|
||||
su_base_port_deferrable,
|
||||
su_base_port_max_defer,
|
||||
su_source_wakeup,
|
||||
su_source_is_running,
|
||||
}};
|
||||
|
||||
static char const *su_source_name(su_port_t const *self)
|
||||
@@ -308,37 +312,10 @@ void su_source_finalize(GSource *gs)
|
||||
su_source_port_deinit(ss->ss_port);
|
||||
}
|
||||
|
||||
void su_source_port_lock(su_port_t *self, char const *who)
|
||||
{
|
||||
PORT_LOCK_DEBUG(("%p at %s locking(%p)...",
|
||||
(void *)g_thread_self(), who, self));
|
||||
|
||||
g_static_mutex_lock(self->sup_mutex);
|
||||
|
||||
PORT_LOCK_DEBUG((" ...%p at %s locked(%p)...",
|
||||
(void *)g_thread_self(), who, self));
|
||||
}
|
||||
|
||||
void su_source_port_unlock(su_port_t *self, char const *who)
|
||||
{
|
||||
g_static_mutex_unlock(self->sup_mutex);
|
||||
|
||||
PORT_LOCK_DEBUG((" ...%p at %s unlocked(%p)\n",
|
||||
(void *)g_thread_self(), who, self));
|
||||
}
|
||||
|
||||
/** @internal Send a message to the port. */
|
||||
int su_source_send(su_port_t *self, su_msg_r rmsg)
|
||||
int su_source_wakeup(su_port_t *self)
|
||||
{
|
||||
int wakeup = su_base_port_send(self, rmsg);
|
||||
GMainContext *gmc;
|
||||
|
||||
if (wakeup < 0)
|
||||
return -1;
|
||||
if (wakeup == 0)
|
||||
return 0;
|
||||
|
||||
gmc = g_source_get_context(self->sup_source);
|
||||
GMainContext *gmc = g_source_get_context(self->sup_source);
|
||||
|
||||
if (gmc)
|
||||
g_main_context_wakeup(gmc);
|
||||
@@ -837,7 +814,7 @@ int su_source_deregister(su_port_t *self, int i)
|
||||
* @return Number of wait objects removed.
|
||||
*/
|
||||
int su_source_unregister_all(su_port_t *self,
|
||||
su_root_t *root)
|
||||
su_root_t *root)
|
||||
{
|
||||
unsigned i, j;
|
||||
unsigned n_waits;
|
||||
@@ -881,8 +858,7 @@ int su_source_unregister_all(su_port_t *self,
|
||||
|
||||
/**Set mask for a registered event. @internal
|
||||
*
|
||||
* The function su_source_eventmask() sets the mask describing events that can
|
||||
* signal the registered callback.
|
||||
* Sets the mask describing events that can signal the registered callback.
|
||||
*
|
||||
* @param port pointer to port object
|
||||
* @param index registration index
|
||||
@@ -892,6 +868,7 @@ int su_source_unregister_all(su_port_t *self,
|
||||
* @retval 0 when successful,
|
||||
* @retval -1 upon an error.
|
||||
*/
|
||||
static
|
||||
int su_source_eventmask(su_port_t *self, int index, int socket, int events)
|
||||
{
|
||||
unsigned n;
|
||||
@@ -932,15 +909,13 @@ int su_source_multishot(su_port_t *self, int multishot)
|
||||
}
|
||||
|
||||
|
||||
/** @internal Main loop.
|
||||
/** @internal Run the main loop.
|
||||
*
|
||||
* The function @c su_source_run() runs the main loop
|
||||
* The main loop runs until su_source_break() is called from a callback.
|
||||
*
|
||||
* The function @c su_source_run() runs until @c su_source_break() is called
|
||||
* from a callback.
|
||||
*
|
||||
* @param self pointer to root object
|
||||
* @param self pointer to port object
|
||||
* */
|
||||
static
|
||||
void su_source_run(su_port_t *self)
|
||||
{
|
||||
GMainContext *gmc;
|
||||
@@ -959,6 +934,11 @@ void su_source_run(su_port_t *self)
|
||||
}
|
||||
}
|
||||
|
||||
static int su_source_is_running(su_port_t *self)
|
||||
{
|
||||
return self->sup_main_loop && g_main_loop_is_running(self->sup_main_loop);
|
||||
}
|
||||
|
||||
/** @internal
|
||||
* The function @c su_source_break() is used to terminate execution of @c
|
||||
* su_source_run(). It can be called from a callback function.
|
||||
@@ -966,6 +946,7 @@ void su_source_run(su_port_t *self)
|
||||
* @param self pointer to port
|
||||
*
|
||||
*/
|
||||
static
|
||||
void su_source_break(su_port_t *self)
|
||||
{
|
||||
enter;
|
||||
@@ -1112,4 +1093,3 @@ void su_glib_prefer_gsource(void)
|
||||
{
|
||||
su_port_prefer(su_source_port_create, NULL);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user