Can't call `dmlab_connect` more than once in a process, disabling multithreading
ava6969 opened this issue · comments
I am building a c++ drl lib, And i need to make my lib support dmlab env, all my other environments run with multithreading but i cant use the regular header file, it says dmlab connect can only be called once per process.
I tried something that seemed to work currently, but i haven't tested if they are all unique environments yet. I'll love to hear what you suggest tho.
Please take a look at https://github.com/deepmind/lab/blob/master/public/dmlab_so_loader.cc, which is a wrapper around the single-instance dmlab_connect
that does the following: The main dmlab code is linked into a shared object (DSO), and every time you create a new instance via the DSO loader, it makes a physical copy of the DSO, and opens that unique copy with dlopen
. That allows you to instantiate Lab repeatedly, and the different DSOs are effectively isolated from one another.
That's how the Python module is implemented, for example.
awesome, thats what i did, Thanks. Just wanted to confirm.