The following macro blocked in batch mode.
The following macro blocked in batch mode.

void wait() {
  gROOT->SetBatch();
  TCanvas *c1 = new TCanvas("c1");
  TH1I *h1 = new TH1I("h1","Histogram",100,1,100);
  h1->Draw();
  c1->Update();
  c1->WaitPrimitive();
  cout << "I am here" << endl;
}

olifre/root,zzxuanyuan/root,karies/root,root-mirror/root,olifre/root,karies/root,root-mirror/root,zzxuanyuan/root,zzxuanyuan/root,olifre/root,olifre/root,karies/root,zzxuanyuan/root,olifre/root,root-mirror/root,olifre/root,olifre/root,root-mirror/root,zzxuanyuan/root,zzxuanyuan/root,zzxuanyuan/root,zzxuanyuan/root,karies/root,zzxuanyuan/root,zzxuanyuan/root,olifre/root,karies/root,root-mirror/root,olifre/root,karies/root,zzxuanyuan/root,karies/root,karies/root,root-mirror/root,olifre/root,root-mirror/root,karies/root,zzxuanyuan/root,karies/root,root-mirror/root,root-mirror/root,karies/root,olifre/root,root-mirror/root,root-mirror/root