threads and loading dll several time in different AppDomain

J

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é
 
W

Willy Denoyette [MVP]

message | 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top