forked from qdaxb/httpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlooper.cpp
More file actions
44 lines (42 loc) · 833 Bytes
/
Copy pathlooper.cpp
File metadata and controls
44 lines (42 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//****************************************************
// Author: Axb - [email protected]
// Create Time: 2013-02-19 13:25
// Filename: looper.cpp
// Description:
//****************************************************
#include <unistd.h>
#include <sys/wait.h>
#include "looper.h"
#include "serverconf.h"
#include "epollpoller.h"
#include "typedef.h"
int Looper::loop()
{
for(int i=0;i<2;i++)
{
// if(fork()>0)
// continue;
//主循环
poller->start();
int n;
for(;;)
{
n=poller->poll();
//for(int i=0;i<n;i++)
//{
// Event *event=poller->nextEvent();
while(poller->handleEvent());
// poller->releaseEvent(event);
//}
}
}
poller->stop();
int status;
while(1)
wait(&status);
}
int Looper::init(ServerConf &conf)
{
this->poller=new EPollPoller();
poller->init(conf);
}