This macro demonstrate usage of ROOT7 graphics from many threads Three different canvases in three different threads are started and regularly updated.
Extra thread created in background and used to run http protocol, in/out websocket communications and process http requests Main application thread (CLING interactive session) remains fully functional
#include <thread>
#include <iostream>
{
auto hist1 =
new TH1D(
"hist1",
"hist1", 100, -10, 10);
auto hist2 =
new TH1D(
"hist2",
"hist2", 100, -10, 10);
for (
int n = 0;
n < 10000; ++
n) {
}
auto canvas = RCanvas::Create(title);
canvas->Show();
std::cout << title << " started" << std::endl;
for (
int loop = 0; loop <
maxloop; ++loop) {
for (
int n = 0;
n < 10000; ++
n) {
}
canvas->Modified();
canvas->Update();
canvas->Run(0.2);
}
std::cout << title << " completed" << std::endl;
canvas->Remove();
}
{
}
} else {
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
static std::shared_ptr< RWebWindowsManager > & Instance()
Returns default window manager Used to display all standard ROOT elements like TCanvas or TFitPanel.
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
1-D histogram with a double per channel (see TH1 documentation)
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
Random number generator class based on M.
void EnableThreadSafety()
Enable support for multi-threading within the ROOT code in particular, enables the global mutex to ma...
- Date
- 2018-08-16
- Warning
- This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
- Author
- Sergey Linev
Definition in file rcanvas_mt.cxx.