On Tue, 20 Jan 2009, Lorenzo Fiorini wrote: Hi,
> I've tried a small test and it works as expected so it must be sth more > complex. > When I open the dbfs I also create some temporary dbfs. > I use a simple if file() to check if there is already a temp file with > that name and if yes I change the file name by a char. > Could it be that check if not atomic enough and that two threads use > the same temporary dbf? Harbour recognize that the same file is reopen using it's inode not name so even if you create hard or soft links to given file then it will be detected that the same file is open and existing open handle reused in new workarea. > I could protect the dbfopen with a mutex. Is it safe to create a > static hash that holds the mutexes in the main thread and access it > using a function? Yes you can. You can keep it in public variable or return by function like in your second mail (slower version). Readonly access to complex variables is guarantied by HVM. It's only important that you will not modify this hash array inserting new items or deleting some existing ones when other threads are executed. best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour