C-ISAM & Solaris Threads
Posted in 2001
Topics: Platform-Specific Issues
Hi all, I've encountered the following problem: using Informix's C-ISAM library in a multi-threaded application (POSIX threads) running on a Sun Solaris 2.6 environment, the application works correctly. Adding some calls to file functions (fopen,...) the C-ISAM library failes to create new archives (isbuild fails with iserrno=17). Note that I've had to add the -mt compiler's option to use the file functions (without it the application halts with "libc internal error: rmutex not held"). The -mt option enables the use of the Solaris threads. Have someone encountered the same problem? Can you give me some help on solving it?
Alessio Biasutto wrote: > I've encountered the following problem: using Informix's C-ISAM library in a > multi-threaded application (POSIX threads) running on a Sun Solaris 2.6 > environment, the application works correctly. Adding some calls to file > functions (fopen,...) the C-ISAM library failes to create new archives > (isbuild fails with iserrno=17). Note that I've had to add the -mt > compiler's option to use the file functions (without it the application > halts with "libc internal error: rmutex not held"). The -mt option enables > the use of the Solaris threads. > > Have someone encountered the same problem? > Can you give me some help on solving it? First off, C-ISAM is *NOT* thread-safe. In fact, it isn't even as simple as wrapping thread-safe functions around the core C-ISAM functions; there are nasty interactions with the isrecnum and isreclen global variables, not to mention iserrno and friends. So, using C-ISAM in a threaded application requires great care, and most probably the indirect use of C-ISAM. Fixing the interfaces so that C-ISAM could be made thread-safe is a major undertaking, incidentally. iserrno=17 is system error 17, EEXIST "File exists". Is there any chance that you are creating a file with the same name as the C-ISAM file (.idx or .dat)? I didn't think so, but it has to be asked. Is mixing Solaris threads with POSIX threads reliable? I seriously doubt if it is portable, but that's a different issue at this point. How are you doing the linking? -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"