Amyuni v2.50g
I have an application that uses multiple threads to create PDF files using the Amyuni driver. However, if I attempt to create lots of files simultaneously (by having multiple threads access the Amyuni driver at the same time) I am occasionally having ::StartDoc fail with GetLastError returning code 87 ('the parameter is incorrect'). The application handle count seems reasonable (less than 1,000) and if I add experimental code to lock access to the driver (using a critical section) so only one thread can use the driver at a time, then the problem goes away. However, locking access like this affects performance and if I use a 'normal' Windows printer driver instead, the problem doesn't occur.
Is there a limit to how many threads can open the Amyuni printer driver? Will v3 (which I have but have yet to try) help?
Any advice would be welcome. At the moment I am considering adding some code that sets a limit on the number of concurrent threads that can access the driver, locking when some magic value is reached.
StartDoc error 87 with multiple threads
OK, I finally got to the bottom of this - the Amyuni driver was creating lots of GDI handles and eventually all handles were exhausted. I have now implemented some locking code to limit the number of threads that can access the driver, and this seems to have fixed the problem. So the Amyuni driver is working as expected.
In mutithreading environments you need to use the locking mechanisme of CDintf or any other locking functions for the jobs not to be overwritten.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html
Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark