|Subject||Re: Thread safety when using libfbembed|
> I believe firebird is thread safe.Probably wrong (depending on what you are doing obviously)
> Is this the case with the embeddedSee above.
> I am having problems when I use connections on different threads. I amEmbedded behaves exactly the same as a Superserver engine because that
> using different connections on each thread (or sharing a connection
> when I know it is used in a mutually exclusive manner).
is all it is.
Threads can indeed be used with embedded Firebird providing two
threads do not attempt to access the same connection at the same time,
or run two queries through the same connection in different threads at
the same time (because the querys are sharing the connection).
If you are having problems, there is a good chance that you are
missing a critical section somewhere (or not obeying it). I have found
the safest approach is to not share connection objects, queries, etc
between different threads at all. If each thread gets its own
instance(s) of these objects, no thread treads on the feet of another.
Of course if you have a reproducable test case where you are totally
threadsafe within your code (and with threads is it always quite hard
to duplicate), then that should be reported back so that if it is a
bug it gets fixed.
But as embedded is just Superserver, threading bugs within the engine
would most likely have been exposed by now through the standard