
Using a non-thread-safe library with threads?
Quote:
>Hello,
>I've been working on a threaded application that needs each thread to
>access a non-thread-safe library. Using mutex locks around the library
>won't work because what I really need is a copy of each library for each
>thread to use (since the library in question seems to maintain state
>accross threads and this really messes things up). I thought about
>copying the library at runtime so each thread has a copy and then
>dlopen()'ing it, but this seems to be a rather ugly hack. Does anyone
>have a better idea? Thanks in advance!
Standard C has no support for threads so there's nothing in the C language
that can help you here. You cross-posted to comp.programming but you
would have been better off in comp.programming.threads. Beyond that you
will have to make use of platform-specific knowledge. If you are using Unix
try comp.unix.programmer or a newsgroup relating to the particular flavour
of Unix you are using.
--
-----------------------------------------
-----------------------------------------