Home All Groups Group Topic Archive Search About

threads and loading dll several time in different AppDomain

Author
25 Jan 2006 4:30 PM
José Joye
Hello,

I have an old style C DLL that is not thread safe (make usage of global
variables).
However, I would need to use it in a multithreaded environment. I'm not too
sure if this would solve my problem:

Whenever a thread is started, load my dll in separated AppDomain (name will
be dynamically allocated based on thread ID,...)

Thanks,
José

Author
25 Jan 2006 5:22 PM
Willy Denoyette [MVP]
Show quote
"José Joye" <jose.joye__KILLTHESPAMS__SMAPSEHTLLIK__@bluewin.ch> wrote in
message news:urMbgycIGHA.3000@TK2MSFTNGP14.phx.gbl...
| Hello,
|
| I have an old style C DLL that is not thread safe (make usage of global
| variables).
| However, I would need to use it in a multithreaded environment. I'm not
too
| sure if this would solve my problem:
|
| Whenever a thread is started, load my dll in separated AppDomain (name
will
| be dynamically allocated based on thread ID,...)
|
| Thanks,
| José
|
|

Regular DLL's are not AD aware, more they are only loaded once in the
calling process, as such it makes no sense to create separate AD's to load
them.
Not sure what problem you have (or think you might have), but if you have to
call into non thread-safe code, you will have to restrict the number of
caller to 1 at any time using locking.



Willy.

AddThis Social Bookmark Button