> >Suppose I have a single-threaded program. At some point that program
> >dlopens a library which was compiled with -D_REENTRANT and is linked with
> >the thread library. In its normal course of operation the library wants to
> >create several threads which would perform whatever the library is
> >supposed to do. Would this work?
> Linking issues aside, threaded executables run just fine on single-cpu
> boxes. So unless there's some unstated requirement for
> "These two threads must run simultaneously or the whole thing locks up"
> you should be fine.
This should not be a problem.
Quote:> Otherwise, the system defaults to (concurrency level)==(number of CPUs),
> which has a tendancy to run the thread consecutively , rather than
I had something else in mind. With the normal MT program the thread library is
mapped and initialized before libc. In the above dlopen() scenario, libc would be
initialized and used before the thread library initialization. I don't know if
there are possible problems with this reversal. And when the program calls dlclose
(eventually), the library would be unmapped, but the thread library would stay for
the entire lifetime of the program.
.-. .-. Sarcasm is just one more service we offer.
(_ \ / _)