[ROOT] CINT thread safety hack?

From: Christoph Bugel (chris@uxsrvc.tti-telecom.com)
Date: Wed May 09 2001 - 17:08:36 MEST


Hi,

I am currently trying out an *ugly* workaround to run multiple cint's
in multiple threads. They don't need to share anything between each
other. Each cint thread will just load a some file and execute a few C
functions from it.  If anyone can point out why the following method
will break - please do!

The workaroud is as following: I compiled cint into a shared library
(.so). My process copies this cint.so into a few identical copies with
*different* names -- one for each thread. for example cint.1.so,
cint.2.so, cint.3.so, etc.  Then, each thread does a dlopen on its own
copy of cint and looks up (dlsym) the symbols it needs (like
G__init_cint, G__loadfile, G__exec_text, etc). Because the dlls have
different names, the code will be entirely loaded each time, so
cint.1.so and cint.2.so are each loaded into another memory location,
and all variables used by cint are multiplexed - even global and static
ones.

This method worked for some simple tests (without cint). This method
does not protect shared resources such as files, but then I think since
cint generates random temporary filenames two thread won't use the same
filename anyway.  It almost works for me already, only I just got a
segfault, and I wondered if I forgot something. (Usually these
segfaults are my own fault) did I miss something important?

Thanks,
Christoph



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:44 MET