Multi-thread capability and non-threaded applications ...
Posted in 1999
Topics: General Discussion
I'm working on a UNIX/Solaris system, and we're just about to move to a version of Informix (7.33 [?]) that supports each individual thread having its own connection to the database, which is something we really want our applications to have. Unfortunately, we link into libraries that also are used by processes that aren't threaded and so don't have or expect any of the threaded behaviour. Now, you have to compile the thread-safe code with different options and some variables than the non-thread-safe code. Since the other processes won't write thread-safe code. but will share some of the same libraries and functions, I was wondering if anyone knows of any problems or nasty side-effects from compiling non-thread-safe code and functions against the thread-safe libraries? Basically, the easiest solution for my problem is to compile all the executables with the -thread option, but if it changes behaviour for non-thread applications that's not going to work. Thanks, Allan C Cybulskie
Alan, Let me rephrase your question.... You have the need to have a multiple thread application. Your current application isn't threadsafe and you don't want to make it thread safe. Can you create thread safe code for the threaded access to Informix and use mixed thread safe and non-thread safe code in the same application? I am assuming of course all the code that will be in the threads will be thread safe? So it would be like creating a thread safe library and having a non-thread safe app use it? -Mikey Allan C Cybulskie wrote: > I'm working on a UNIX/Solaris system, and we're just about to move to a version of Informix (7.33 [?]) that supports each individual thread having its own connection to the database, which is something we really want our applications to have. Unfortunately, we link into libraries that also are used by processes that aren't threaded and so don't have or expect any of the threaded behaviour. Now, you have to compile the thread-safe code with different options and some variables than the non-thread-safe code. Since the other processes won't write thread-safe code. but will share some of the same libraries and functions, I was wondering if anyone knows of any problems or nasty side-effects from compiling non-thread-safe code and functions against the thread-safe libraries? Basically, the easiest solution for my problem is to compile all the executables with the -thread option, but if it changes behaviour for non-thread applications that's not going to work. > > Thanks, > Allan C Cybulskie
>Alan, >Let me rephrase your question.... >You have the need to have a multiple thread application. Actually, we have a couple of multiple threaded applications that use the same libraries as other applications that are not multi-threaded, that we build into the same overall software product. >Your current application isn't threadsafe and you don't want to make it t= >hread safe. >Can you create thread safe code for the threaded access to Informix and u= >se >mixed thread safe and non-thread safe code in the same application? Actually, I'm more worried about the compilation. I know that you can't mix an application that is compiled as multi-threaded with one that is not, but we'd probably be okay if we didn't compile the same libraries for different applications, because the applications have, otherwise, different code bases and different libraries. Maybe I'm not getting the right idea of "application", though. >I am assuming of course all the code that will be in the threads will be = >thread safe? >So it would be like creating a thread safe library and having a non-threa= >d safe app >use it? Kind of, but more like compiling a library that is probably not thread-safe as a thread-safe library so that it won't cause the thread-safe app that also uses that library to choke. Thanks, Allan C Cybulskie