Menu

[r9]: / framework / trunk / main.cpp  Maximize  Restore  History

Download this file

57 lines (39 with data), 960 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
45
46
47
48
49
50
51
52
53
54
55
56
#include <boost/scoped_array.hpp>
#include <pthread.h>
#include <sstream>
#include "cgicc/Cgicc.h"
#include "cgicc/HTTPHTMLHeader.h"
#include "cgicc/HTMLClasses.h"
#include "fcgio.h"
#include "main_thread.h"
#include "thread_pool.h"
#include "global_config.h"
using namespace std;
using namespace boost;
int main(int argc,char **argv)
{
try{
global_config.load(argc,argv);
int n,max;
char const *socket=global_config.sval("server.socket","").c_str();
if((n=global_config.lval("server.threads",0))==0) {
FastCGI_ST<Main_Thread> app(socket);
app.execute();
}
else {
max=global_config.lval("server.buffer",1);
FastCGI_MT<Main_Thread> app(n,max,socket);
app.execute();
long long const *stats=app.get_stats();
int i;
for(i=0;i<n;i++){
cout<<"Thread "<<i<<" executed "<<stats[i]<< " times\n";
}
}
cout<<"Finished\n"<<endl;
}
catch(HTTP_Error &s) {
cerr<<s.get()<<endl;
}
return 0;
}
MongoDB Logo MongoDB