Skip to content

Commit

Permalink
net, refactor: remove unused event from libev.
Browse files Browse the repository at this point in the history
  • Loading branch information
xicilion committed Oct 25, 2017
1 parent f0459a3 commit 666ae9f
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions fibjs/src/io/AsyncIO_ev.cpp
Expand Up @@ -192,19 +192,17 @@ class _acIO : public exlib::OSThread {


virtual void Run() virtual void Run()
{ {
Runtime rt(NULL);

ev_async_init(&s_asEvent, as_cb); ev_async_init(&s_asEvent, as_cb);
ev_async_start(s_loop, &s_asEvent); ev_async_start(s_loop, &s_asEvent);


ev_timer tm;
tm_cb(s_loop, &tm, 0);

Runtime rt(NULL);

ev_run(s_loop, 0); ev_run(s_loop, 0);
} }


private: private:
static void doAsync() static void as_cb(struct ev_loop* loop, struct ev_async* watcher,
int32_t revents)
{ {
exlib::List<asyncEv> jobs; exlib::List<asyncEv> jobs;
asyncEv* p1; asyncEv* p1;
Expand All @@ -214,21 +212,6 @@ class _acIO : public exlib::OSThread {
while ((p1 = jobs.getHead()) != 0) while ((p1 = jobs.getHead()) != 0)
p1->start(); p1->start();
} }

static void tm_cb(struct ev_loop* loop, struct ev_timer* watcher,
int32_t revents)
{
ev_timer_init(watcher, tm_cb, 10, 0);
ev_timer_start(s_loop, watcher);

doAsync();
}

static void as_cb(struct ev_loop* loop, struct ev_async* watcher,
int32_t revents)
{
doAsync();
}
}; };


void init_aio() void init_aio()
Expand Down

0 comments on commit 666ae9f

Please sign in to comment.