oliveiros junior wrote:
I am using a Thread to execute a routine for creating and indexing files (DBF), so far so good. In the same Thread I open the files, but when I close the Thread and try to use a file, I get the message that it is not open. Is there a way to get around this?
No.
This is harbour default, and it is the best way to use multithread.
Each thread is like an EXE.
Files are opened on one thread, not on another.
On multithread you can use CLOSE DATABASES and only DBF on that thread will be closed.
I do not make full use of fivewin, may be code is wrong:
USE ARQ1 SHARED
hb_ThreadStart( { || test() } )
browse()
CLOSE DATABASES
...
FUNCTION Test()
USE ARQ1 SHARED
browse()
CLOSE DATABASES
RETURN Nil
You will have 2 browses, one on each thread, file need to be opened on each thread, alias on one thread is not visible on another, you can use same alias for any file.
CLOSE DATABASES will close only file on that thread.
The best: you can change index order, record position, apply filter, and one thread do not change another.
Caution about this:
Create dialog on one thread and run on another thread is not the same as make all on same thread.