Subject Re: [firebird-support] Firebird 25 thread safety
Author Michael Ludwig
ma_golyo schrieb am 21.01.2011 um 13:54 (-0000):
>
> From the documentation : "The client libraries, including the embedded
> one, can now be used in multi-threaded applications without any
> application-level synchronization."

I could certainly google that sentence, but I'll just note it's good
style to give a reference when quoting.

> What does this exactly mean?

Seems to mean that concurrency is handled at the library. The app
developers don't have to care, the burden is taken away from them.

> #1 : Can I use only a single connection accessing by multiple
> transactions from different threads at the same time?

That won't work. Think about it. There's a connection used by thread A
for query X. At some random point in the middle of a transaction, let's
say thread A has fetched the first 20 out of perhaps 123 records, the
OS passes control to thread B. Well, thread B also has a reference to
the connection but is totally unaware of the work performed on that
connection by thread A. So when thread B merrily calls prepare() or
what not on the connection, it'll trigger an exception.

> #2 : Can I use only a single transaction accessing by multiple
> "querys" from different threads at the same time?

I think this is about the same as #1.

--
Michael Ludwig