Commit 528bf0db authored by Pekka Pessi's avatar Pekka Pessi

su_port.h: removed su_port_threadsafe() and su_port_yield() methods

su_port_wait_events() replaces su_port_yield().

darcs-hash:20071005112810-55b16-ead9d1cfa3e32b64bafb0ad827674694f467b89e.gz
parent 4fb20afe
...@@ -155,8 +155,6 @@ su_port_vtable_t const su_source_port_vtable[1] = ...@@ -155,8 +155,6 @@ su_port_vtable_t const su_source_port_vtable[1] =
su_source_remove_prepoll, su_source_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_source_multishot, su_source_multishot,
su_base_port_threadsafe,
/*su_source_yield*/ NULL,
/*su_source_wait_events*/ NULL, /*su_source_wait_events*/ NULL,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -297,12 +297,6 @@ int su_base_port_multishot(su_port_t *self, int multishot) ...@@ -297,12 +297,6 @@ int su_base_port_multishot(su_port_t *self, int multishot)
return 0; return 0;
} }
/** @internal Enable threadsafe operation. */
int su_base_port_threadsafe(su_port_t *self)
{
return su_home_threadsafe(self->sup_home);
}
/** @internal Main loop. /** @internal Main loop.
* *
* The function @c su_port_run() waits for wait objects and the timers * The function @c su_port_run() waits for wait objects and the timers
...@@ -501,22 +495,6 @@ su_timer_queue_t *su_base_port_timers(su_port_t *self) ...@@ -501,22 +495,6 @@ su_timer_queue_t *su_base_port_timers(su_port_t *self)
return &self->sup_timers; return &self->sup_timers;
} }
/* ====================================================================== */
/** @internal
* Used to check wait events in callbacks that take lots of time
*
* This function does a timeout 0 poll() and runs wait objects.
*
* @param port pointer to port
*
* @return number of events handled
*/
int su_base_port_yield(su_port_t *self)
{
return self->sup_vtable->su_port_wait_events(self, 0);
}
/* ====================================================================== /* ======================================================================
* Clones * Clones
*/ */
......
...@@ -141,8 +141,6 @@ su_port_vtable_t const su_devpoll_port_vtable[1] = ...@@ -141,8 +141,6 @@ su_port_vtable_t const su_devpoll_port_vtable[1] =
su_base_port_remove_prepoll, su_base_port_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_devpoll_port_multishot, su_devpoll_port_multishot,
su_base_port_threadsafe,
su_base_port_yield,
su_devpoll_port_wait_events, su_devpoll_port_wait_events,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -136,8 +136,6 @@ su_port_vtable_t const su_epoll_port_vtable[1] = ...@@ -136,8 +136,6 @@ su_port_vtable_t const su_epoll_port_vtable[1] =
su_base_port_remove_prepoll, su_base_port_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_epoll_port_multishot, su_epoll_port_multishot,
su_base_port_threadsafe,
su_base_port_yield,
su_epoll_port_wait_events, su_epoll_port_wait_events,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -133,8 +133,6 @@ su_port_vtable_t const su_kqueue_port_vtable[1] = ...@@ -133,8 +133,6 @@ su_port_vtable_t const su_kqueue_port_vtable[1] =
su_base_port_remove_prepoll, su_base_port_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_kqueue_port_multishot, su_kqueue_port_multishot,
su_base_port_threadsafe,
su_base_port_yield,
su_kqueue_port_wait_events, su_kqueue_port_wait_events,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -197,8 +197,6 @@ su_port_vtable_t const su_osx_port_vtable[1] = ...@@ -197,8 +197,6 @@ su_port_vtable_t const su_osx_port_vtable[1] =
su_base_port_remove_prepoll, su_base_port_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_osx_port_multishot, su_osx_port_multishot,
su_base_port_threadsafe,
su_base_port_yield,
su_osx_port_wait_events, su_osx_port_wait_events,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -134,8 +134,6 @@ su_port_vtable_t const su_poll_port_vtable[1] = ...@@ -134,8 +134,6 @@ su_port_vtable_t const su_poll_port_vtable[1] =
su_base_port_remove_prepoll, su_base_port_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_poll_port_multishot, su_poll_port_multishot,
su_base_port_threadsafe,
su_base_port_yield,
su_poll_port_wait_events, su_poll_port_wait_events,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -134,9 +134,6 @@ typedef struct su_port_vtable { ...@@ -134,9 +134,6 @@ typedef struct su_port_vtable {
int (*su_port_multishot)(su_port_t *port, int multishot); int (*su_port_multishot)(su_port_t *port, int multishot);
int (*su_port_threadsafe)(su_port_t *port);
/* Extension from > 1.12.0 */
int (*su_port_yield)(su_port_t *port);
/* Extension from >= 1.12.4 */ /* Extension from >= 1.12.4 */
int (*su_port_wait_events)(su_port_t *port, su_duration_t timeout); int (*su_port_wait_events)(su_port_t *port, su_duration_t timeout);
int (*su_port_getmsgs)(su_port_t *port); int (*su_port_getmsgs)(su_port_t *port);
...@@ -385,13 +382,6 @@ int su_port_multishot(su_port_t *self, int multishot) ...@@ -385,13 +382,6 @@ int su_port_multishot(su_port_t *self, int multishot)
return base->sup_vtable->su_port_multishot(self, multishot); return base->sup_vtable->su_port_multishot(self, multishot);
} }
su_inline
int su_port_threadsafe(su_port_t *self)
{
su_virtual_port_t *base = (su_virtual_port_t *)self;
return base->sup_vtable->su_port_threadsafe(self);
}
su_inline su_inline
int su_port_getmsgs(su_port_t *self) int su_port_getmsgs(su_port_t *self)
{ {
...@@ -479,10 +469,6 @@ SOFIAPUBFUN su_timer_t **su_base_port_timers(su_port_t *self); ...@@ -479,10 +469,6 @@ SOFIAPUBFUN su_timer_t **su_base_port_timers(su_port_t *self);
SOFIAPUBFUN int su_base_port_multishot(su_port_t *self, int multishot); SOFIAPUBFUN int su_base_port_multishot(su_port_t *self, int multishot);
SOFIAPUBFUN int su_base_port_threadsafe(su_port_t *self);
SOFIAPUBFUN int su_base_port_yield(su_port_t *self);
SOFIAPUBFUN int su_base_port_start_shared(su_root_t *parent, SOFIAPUBFUN int su_base_port_start_shared(su_root_t *parent,
su_clone_r return_clone, su_clone_r return_clone,
su_root_magic_t *magic, su_root_magic_t *magic,
......
...@@ -762,24 +762,11 @@ su_duration_t su_root_sleep(su_root_t *self, su_duration_t duration) ...@@ -762,24 +762,11 @@ su_duration_t su_root_sleep(su_root_t *self, su_duration_t duration)
*/ */
int su_root_yield(su_root_t *self) int su_root_yield(su_root_t *self)
{ {
su_port_t *port;
su_virtual_port_t *base;
if (self == NULL) if (self == NULL)
return (void)(errno = EFAULT), SU_WAIT_FOREVER; return (void)(errno = EFAULT), SU_WAIT_FOREVER;
assert(self->sur_port); assert(self->sur_port);
port = self->sur_task[0].sut_port; return su_port_wait_events(self->sur_port, 0);
base = (su_virtual_port_t *)port;
if (base->sup_vtable->su_port_wait_events)
return base->sup_vtable->su_port_wait_events(port, 0);
if (base->sup_vtable->su_port_yield)
return base->sup_vtable->su_port_yield(port);
errno = ENOSYS;
return -1;
} }
/** Get task reference. /** Get task reference.
......
...@@ -153,8 +153,6 @@ su_port_vtable_t const su_select_port_vtable[1] = ...@@ -153,8 +153,6 @@ su_port_vtable_t const su_select_port_vtable[1] =
su_base_port_remove_prepoll, su_base_port_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_select_port_multishot, su_select_port_multishot,
su_base_port_threadsafe,
su_base_port_yield,
su_select_port_wait_events, su_select_port_wait_events,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -132,8 +132,6 @@ su_port_vtable_t const su_wsevent_port_vtable[1] = ...@@ -132,8 +132,6 @@ su_port_vtable_t const su_wsevent_port_vtable[1] =
su_base_port_remove_prepoll, su_base_port_remove_prepoll,
su_base_port_timers, su_base_port_timers,
su_wsevent_port_multishot, su_wsevent_port_multishot,
su_base_port_threadsafe,
su_base_port_yield,
su_wsevent_port_wait_events, su_wsevent_port_wait_events,
su_base_port_getmsgs, su_base_port_getmsgs,
su_base_port_getmsgs_from, su_base_port_getmsgs_from,
......
...@@ -197,7 +197,7 @@ int test_register(void) ...@@ -197,7 +197,7 @@ int test_register(void)
su_root_size_hint = 16; su_root_size_hint = 16;
TEST_1(port = su_poll_port_create()); TEST_1(port = su_poll_port_create());
TEST(su_port_threadsafe(port), 0); TEST(su_home_threadsafe(su_port_home(port)), 0);
/* Before 1.12.4 su_port_create() had reference count 0 after creation */ /* Before 1.12.4 su_port_create() had reference count 0 after creation */
/* su_port_incref(port, "test_register"); */ /* su_port_incref(port, "test_register"); */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment