Permalink
Browse files

core, refactor: AsyncEvent base on Task_base.

  • Loading branch information...
xicilion committed Oct 22, 2017
1 parent 39ed71a commit 51e88700ad000f215453f3096732e48f4e6daa5a
View
@@ -8,7 +8,7 @@
namespace fibjs {
class AsyncEvent : public exlib::linkitem {
class AsyncEvent : public exlib::Task_base {
public:
AsyncEvent()
: m_async(false)
@@ -19,6 +19,11 @@ class AsyncEvent : public exlib::linkitem {
{
}
public:
virtual void resume()
{
}
public:
void sync(Isolate* isolate)
{
@@ -331,8 +336,7 @@ class _at<T*> {
};
class NType;
class AsyncCallBack : public AsyncEvent,
public exlib::Task_base {
class AsyncCallBack : public AsyncEvent {
public:
AsyncCallBack(v8::Local<v8::Function> cb)
{
@@ -350,15 +354,6 @@ class AsyncCallBack : public AsyncEvent,
}
public:
virtual void suspend()
{
}
virtual void suspend(exlib::spinlock& lock)
{
lock.unlock();
}
virtual void resume()
{
async(m_v);
View
@@ -43,15 +43,6 @@ class Timer : public Timer_base,
public:
// exlib::Task_base
virtual void suspend()
{
}
virtual void suspend(exlib::spinlock& lock)
{
lock.unlock();
}
virtual void resume()
{
asyncCall(_callback, this);
@@ -210,15 +210,6 @@ result_t coroutine_base::sleep(int32_t ms, AsyncEvent* ac)
public:
// exlib::Task_base
virtual void suspend()
{
}
virtual void suspend(exlib::spinlock& lock)
{
lock.unlock();
}
virtual void resume()
{
m_ac->post(0);
@@ -116,15 +116,6 @@ class asyncProc : public asyncEv,
}
public:
virtual void suspend()
{
}
virtual void suspend(exlib::spinlock& lock)
{
lock.unlock();
}
virtual void resume()
{
post();
@@ -56,15 +56,6 @@ class asyncProc : public OVERLAPPED,
}
public:
virtual void suspend()
{
}
virtual void suspend(exlib::spinlock& lock)
{
lock.unlock();
}
virtual void resume()
{
PostQueuedCompletionStatus(s_hIocp, -1, -1, (LPOVERLAPPED)this);
@@ -322,7 +322,6 @@ result_t WebSocketMessage::sendTo(Stream_base* stm, AsyncEvent* ac)
result_t WebSocketMessage::readFrom(Stream_base* stm, AsyncEvent* ac)
{
class asyncReadFrom : public AsyncState {
public:
asyncReadFrom(WebSocketMessage* pThis, Stream_base* stm,
2 vender
Submodule vender updated 1 files
+9 −2 exlib/include/fiber.h

0 comments on commit 51e8870

Please sign in to comment.