Hi,
is it safe to call InsertPagesFromDoc from multiple threads each with a separate destination document but a shared source document?
I.e. I open a single pSrcDoc in a thread, then I create a couple of worker threads which create new documents and call InsertPagesFromDoc using the same source doc.
Or do I have to use a dedicated instance of the source document in every worker thread, i.e. re-open it in every thread?
Thanks,
Patrick
IPXC_Pages::InsertPagesFromDoc source document
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
- Lzcat - Tracker Supp
- Site Admin
- Posts: 677
- Joined: Thu Jun 28, 2007 8:42 am
Re: IPXC_Pages::InsertPagesFromDoc source document
Hi, pschlan
In theory it is safe to do this, but when inserting pages from one document to another both documents are exclusively locked, so while one thread will do work all other will wait for source document became unlocked. For best performance you should have one copy of source document per each thread. Be aware that InsertPagesFromDoc may require significant amount of memory (depending on source and destination documents), so it is not recommended to do this in parallel in 32-bit code or when you have limited amount of RAM.
Kind regards,
Lzcat - Tracker Supp
In theory it is safe to do this, but when inserting pages from one document to another both documents are exclusively locked, so while one thread will do work all other will wait for source document became unlocked. For best performance you should have one copy of source document per each thread. Be aware that InsertPagesFromDoc may require significant amount of memory (depending on source and destination documents), so it is not recommended to do this in parallel in 32-bit code or when you have limited amount of RAM.
Kind regards,
Lzcat - Tracker Supp
Victor
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Re: IPXC_Pages::InsertPagesFromDoc source document
This is very useful information, thank you!
Re: IPXC_Pages::InsertPagesFromDoc source document
Follow-up question: Any easy way to clone an IPXC_Document, or do I have to load from file multiple times?
- Lzcat - Tracker Supp
- Site Admin
- Posts: 677
- Joined: Thu Jun 28, 2007 8:42 am
Re: IPXC_Pages::InsertPagesFromDoc source document
Hi, pschlan
There is no way to clone IPXC_Document, best solution is open multiple times.
Kind regards,
Lzcat - Tracker Supp
There is no way to clone IPXC_Document, best solution is open multiple times.
Kind regards,
Lzcat - Tracker Supp
Victor
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Re: IPXC_Pages::InsertPagesFromDoc source document
Ok, even with the locking in place and shared documents I already see a tremendous speedup
Thanks again!
Thanks again!
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact: