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.
 

Cromulent

macrumors 604
Oct 2, 2006
6,817
1,102
The Land of Hope and Glory
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.
 

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
pp part 2

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

Sander

macrumors 6502a
Apr 24, 2008
521
67
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).
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
You could use multiple sub-processes instead of threads. The sub-processes would be single threaded so no issues with the library.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
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.
 

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
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.