I compiled and run the following code.
But, I can not call the function from the web browser because of scope error.
Do you know how to register the function as the command ?
#include <TH1.h>
#include <THttpServer.h>
#include <TRandom3.h>
bool LoopFlag = true;
void ExitFunc(void){
LoopFlag = false;
}
int main(int argn, char* argv[]) {
THttpServer* serv = new THttpServer("http:8080?top=Test");
serv->RegisterCommand("/Exit","ExitFunc()");
int i = 0;
TRandom3 random;
TH1F *hist = new TH1F("hist", "hist", 1000, 0, 1);
while (LoopFlag) {
double rnd = random.Rndm(1);
hist->Fill(rnd);
if ((i % 1000000) == 0) {
serv->ProcessRequests();
}
i++;
}
return 0;
}
Thanks.