I'm looking for a way to do something with a bunch of pdf documents in separate thread(s) ... browsing the sdk help, and I think I've found what seems to be the way to go - and would need some guidance / confirmation / explanations before I start heavy coding...
I have an array of PDFs and for each I'd need my custom IOperation to be executed *not* in the main app thread. I also need to be able to cancel the process at any point - something similar to how the op.search (inside a folder) works - the search results are populated in a different thread and the Stop button can be used to stop the search.
Here's how I think this should work and would like your comments :
Code: Select all
//pseudo
for each pdf do
{
1. IPXV_Inst::AsyncDo to run an IOperation (with pdf as input parameter) in background thread
2. During the execution of IOperation.Do periodically call IPXV_Inst::ThreadSafeCall
3. In OnThreadSafeCall check main thread for "my stop flag" - if set exit the Do method (this will fire IPXV_AsyncDoCallback.OnFinishOp)
4. Check for stop flag in IPXV_AsyncDoCallback.OnStartOp to check if "this" operation in thread pool should even start executing.
}
What will happen if the are operations still to be executed and I try to close the app (Inst.Shutdown)?
How may threads are used by sdk? Is this specified in Preferences - Performance - Threads / working threads ? If so, how do you determine the number of threads for "automatic" value?
-žarko