-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (41 loc) · 1.06 KB
/
main.cpp
File metadata and controls
57 lines (41 loc) · 1.06 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <bits/stdc++.h>
#include <unistd.h>
#include <errno.h>
#include "thread_pool.h"
#include "MyServer.h"
#include <arpa/inet.h> /* inet_ntoa */
#include <dirent.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
using namespace std;
void dispatch_to_me()
{
int default_port = 8080,listenfd;
// char buf[256];
// char *path = getcwd(buf, 256);
listenfd = getConnection(default_port);
if (listenfd > 0) {
printf("listen on port %d, fd is %d\n", default_port, listenfd);
}
else {
perror("ERROR");
exit(listenfd);
}
}
int main(){
// threadpool tp;
// tp = create_threadpool(7);
// printf("ThreadPool created with 7 threads\n");
int i=1;
dispatch_to_me() ;
// dispatch(tp, dispatch_to_me, (void *) i);
fprintf(stdout, "**main** done first\n");
sleep(1);
fprintf(stdout, "\n\n");
fprintf(stdout, "**main done second\n");
// destroy_threadpool(tp);
sleep(5);
exit(-1);
return 0;
}