Subject Re: [firebird-support] Re: SELECT ONLY database query performance
Author Vlad Horsun
> Hello Vlad,
>
> > Exactly what i wrote. You must not have more than one thread
> calling
> > isc_attach_database (or TIBDatabase.Open if you use IBX for example)
> > simultaneously. Reread my message again ;)
>
> Is this also true if you have a separate instance of a TIBDatabase (or
> equivalent) per thread?

Of course yes.

There are only two very simple requirements (known to me) :

a) you must not perform more than one isc_attach_database call
simultaneously (from different threads)

b) you must not perform more than one operation one the same
attachment simultaneously

Simplest (but not only) way to satisfy this requirements is to serialize
isc_attach_database calls with critical section (or mutex) and operate
one the some attachment within the single thread

> If so, what is the scope (system-wide mutex) or is an application wide
> critical section sufficient.

Application wide. It is related with some inner details of client library

I not quite sure that attach synchronization is required for _embedded_
but it can't hurt performance if your application make something else
except of connect\disconnect ;)

Regards,
Vlad