Page 1 of 1

Multi threading

Posted: Tue 19 Oct 2010 08:43
by sandy771
I am writinga multithreaded application and want to execute a thread that dows some processing on an sqlite database while the main application continues to access the database.

The thread will read from the db and will usually update every row, possible a few 10's of million, but no new rows will be added.

The main application will read from the db and possibly update the odd row here and there but again no new rows will be added.

I am new to thread programming so iam a bit inthe dark here and wanted some feedback on the best way to do this.

I am considering just creating a query component within the thread and attaching it to the uniConection in the main app - can i do this, it seems a little simple and I feeel I am missing something.

Posted: Tue 19 Oct 2010 12:08
by AlexP
Hello,

The best way to work with UniDAC in the multithread application is create new connection for each thread, but you can use single connection for all threads; in this case you should set the TUniQuery.Connection property in the thread, where this TUniQuery is declared.