dkounal 3 Posted November 8, 2020 I have to update an application that has 20 threads running at the same time and each thread is requesting an XML through an http connection. In order to process the received XML, each thread has to use data from 14 TFDMemtables. The Threads are the same running all the time and the TFDMemtables they use are also the same, The TFDMemTables' data are static, received from an external database when application starts, not need to be updated/edited as the application runs. I read that with TFDMemTable you can use clonecursor and have different TFDMemTable object instances with the same data. I though that I could create such a TFDMemTable for each thread before threads start to use them. My question: Can different threads use TFDMemTables object instances (created with data from clonecursor) from an initial TFDMemTable? Is this threadsafe? Thank you in advace Share this post Link to post
Lachlan Gemmell 33 Posted November 9, 2020 Back in 2014 the lead architect of FireDAC confirmed it is not threadsafe. That was quite a while ago but to the best of my knowledge that has not changed. Share this post Link to post
Anders Melander 1782 Posted November 9, 2020 21 hours ago, dkounal said: Can different threads use TFDMemTables object instances (created with data from clonecursor) from an initial TFDMemTable? Is this threadsafe? Yes. Moving the cursor in a clone does not affect the other clones. 5 hours ago, Lachlan Gemmell said: Back in 2014 the lead architect of FireDAC confirmed it is not threadsafe. As I read that post read access to a cloned dataset is thread safe. 1 Share this post Link to post
Lachlan Gemmell 33 Posted November 9, 2020 I see the question was asking for threadsafe read-only access so I agree an TFDMemTable will be suitable for his needs. Share this post Link to post
dkounal 3 Posted November 9, 2020 Thank you very much. This is really good news for my application. Share this post Link to post