#include "EventLoop.h"
#include "EventLoopThread.h"

#include <stdio.h>
#include <unistd.h>

void runInThread() {
    printf("runInThread: pid = %d, tid = %d\n", getpid(), muduo::CurrentThread::tid());
}


int main() {
    printf("main(): pid = %d, tid = %d\n", getpid(), muduo::CurrentThread::tid());

    muduo::EventLoopThread loopThread;
    muduo::EventLoop* loop = loopThread.startLoop();

    loop->runInLoop(runInThread);
    sleep(1);

    loop->runAfter(2, runInThread);
    sleep(3);

    loop->quit();

    sleep(3);

    printf("exit main().\n");

    return 0;
}