I also tried to generate the TMapFile in one thread and plot the histograms in another one but in this case I obtain the same error message. It seems that the TCanvas can not be created using rootn.exe
Finally I have build a standalone application to read the TMapFile content. This standalone application has been compile the following way:
“rootn.exe” is maybe a legacy of old root versions. It is just the “root” executable linked with the libNew.so library. The use of it is indicated when one try to create an instance of the TMapFile class in a standard ROOT session like this:
root  TMapFile *mf=TMapFile::Create("test.map","recreate")
Error in <TMapFile::TMapFile>: no memory mapped file capability available
Use rootn.exe or link application against "-lNew"
If the TMapFile class is not maintained anymore in the new ROOT versions, I will forget to use it.
Strictly speaking I do not need to use the TMapFile class. I have just seen in the (old) documentation that this could be a possibility to share TObjects for different threads or different ROOT simultaneous sessions. If the TMapFile class is obsolete, I will not use it in the future.
You can still share objects between threads without TMapFile (e.g. by running a lambda in a thread that captures a given histogram by reference). Of course if you write to them from multiple threads, you need to be aware whether they are thread-safe or not, and protect the accesses in the latter case (e.g. TH1 is not thread safe).
@pcanal can perhaps comment better on the use of rootn + TMapFile for simultaneous ROOT sessions.
It should not be used for sharing with threads. It is explicitly intended to use “shared memory” to pass information from one process to another.
So far on Ubuntu 20.04.4 and a debug build of the tip of the main branch, your example works for me.
However, it was failing before I upgraded in a Release build of an older version of ROOT (on Ubuntu 18). I will check if it works in a Release build with Ubuntu 20.04.4 and the tip of the main branch.