Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
I now have a program which successfully runs multiple threads. When I add a call to a function in an external library it fails if there is more than one thread. The error says "too many I/O drivers". Without knowing the specifics of the library (CFITSIO for manipulating fits files), does anybody have any insight into this error.

Thanks.
 
I now have a program which successfully runs multiple threads. When I add a call to a function in an external library it fails if there is more than one thread. The error says "too many I/O drivers". Without knowing the specifics of the library (CFITSIO for manipulating fits files), does anybody have any insight into this error.

Thanks.

Some libraries are not thread safe. Check the documentation to make sure.
 
pp part 2

A non threaded version of the code?. That defeats it's purpose. I need speed. There are other work arounds though.
 
A non threaded version of the code?. That defeats it's purpose. I need speed. There are other work arounds though.

You can also try serializing just the access to this particular library (unless the bulk of the work happens in there, in which case it indeed would defeat the purpose).
 
You could use multiple sub-processes instead of threads. The sub-processes would be single threaded so no issues with the library.
 
I now have a program which successfully runs multiple threads. When I add a call to a function in an external library it fails if there is more than one thread. The error says "too many I/O drivers". Without knowing the specifics of the library (CFITSIO for manipulating fits files), does anybody have any insight into this error.

If the library is not thread safe, try protecting all calls to it with a mutex. Or maybe the library wants to be initialised _once_, and each one of your threads initialises it.
 
mutex

Thanks. I will look into this. Unfortunately, my knowledge does not extend far enough to understand your suggestion. I'll try google but if you could be more specific, I would appreciate it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.