Multi threading
Posted: Fri 26 Nov 2010 15:57
I have a database that I want to index as a background task (the index creation process takes about 20 mins).
AT the moment I create a separte thread pass it a handle to a TUniQuery, create the indexes (about 20 of them) in the Execute method and then resume the thread.
When I do this sqlite shows that the indexes are created but when I access the database it behaves as if they have not.
I send a message when the thread terminates to indicate when the indexes have been created but this seems to return after about a minute, ether than the 20 I am expecting.
I am thinkingthat I should be createing a separate connection within the thread - would this be better?
AT the moment I create a separte thread pass it a handle to a TUniQuery, create the indexes (about 20 of them) in the Execute method and then resume the thread.
When I do this sqlite shows that the indexes are created but when I access the database it behaves as if they have not.
I send a message when the thread terminates to indicate when the indexes have been created but this seems to return after about a minute, ether than the 20 I am expecting.
I am thinkingthat I should be createing a separate connection within the thread - would this be better?