MT#56374 remove poller_update_item

Unused function.

This also simplifies poller_add_item.

Change-Id: I16166b5a3b4f71c05d4a89a990ceecf6a33ab7a3
pull/1701/head
Richard Fuchs 2 years ago
parent 386f1d91bf
commit 20633a8c19

@ -146,8 +146,7 @@ static void poller_item_free(void *p) {
}
/* unlocks on return */
static int __poller_add_item(struct poller *p, struct poller_item *i, int has_lock) {
int poller_add_item(struct poller *p, struct poller_item *i) {
struct poller_item_int *ip;
unsigned int u;
struct epoll_event e;
@ -163,8 +162,7 @@ static int __poller_add_item(struct poller *p, struct poller_item *i, int has_lo
if (!i->closed)
goto fail_lock;
if (!has_lock)
mutex_lock(&p->lock);
mutex_lock(&p->lock);
if (i->fd < p->items_size && p->items[i->fd])
goto fail;
@ -197,17 +195,11 @@ fail:
mutex_unlock(&p->lock);
return -1;
fail_lock:
if (has_lock)
mutex_unlock(&p->lock);
mutex_unlock(&p->lock);
return -1;
}
int poller_add_item(struct poller *p, struct poller_item *i) {
return __poller_add_item(p, i, 0);
}
int poller_del_item(struct poller *p, int fd) {
struct poller_item_int *it;
@ -238,37 +230,6 @@ fail:
}
int poller_update_item(struct poller *p, struct poller_item *i) {
struct poller_item_int *np;
if (!p || !i)
return -1;
if (i->fd < 0)
return -1;
if (!i->readable && !i->writeable)
return -1;
if (!i->closed)
return -1;
mutex_lock(&p->lock);
if (i->fd >= p->items_size || !(np = p->items[i->fd]))
return __poller_add_item(p, i, 1);
obj_hold_o(i->obj);
obj_put_o(np->item.obj);
np->item.obj = i->obj;
np->item.uintp = i->uintp;
np->item.readable = i->readable;
np->item.writeable = i->writeable;
np->item.closed = i->closed;
mutex_unlock(&p->lock);
return 0;
}
static int poller_poll(struct poller *p, int timeout) {
int ret, i;
struct poller_item_int *it;

@ -35,7 +35,6 @@ struct poller *poller_map_get(struct poller_map *);
void poller_map_free(struct poller_map **);
void poller_free(struct poller **);
int poller_add_item(struct poller *, struct poller_item *);
int poller_update_item(struct poller *, struct poller_item *);
int poller_del_item(struct poller *, int);
void poller_blocked(struct poller *, void *);

Loading…
Cancel
Save