This is weird. I imagine you have this code inside a macro named test.C. You enter root and then type .x test.C. Then you should see the canvas with the histogram in it and you should get back the ROOT prompt . In principal you do not even need: any code after h1->Draw();.
For me too … what do you get exactly ? a white canvas ? nothing ?
try to start with the option -n in case you have something weird in your rootlogon,C
Note that the canvas will be “unresponsive” during gSystem->Sleep(5000); (so it will NOT be redrawn / refreshed if its contents is “blanked” by the X11 system when switching active windows or desktops).
what do you get exactly ? a white canvas ? nothing ?
I write online monitor with two threads and GUI (standalone app).
In order to test some code I use simple macro with one thread.
I need opportunity to emulate to two threads, so gSystem->Sleep() is good choice for me.
But I need to update my canvas inside macro.