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.