On Fri, Apr 16, 2010 at 18:18, Ivan Arabadzhiev
<intelru...@unrealsoft.net> wrote:
> Hi,
> I`ve asked before (and yes, I remember the provider is not thread safe),
> but I recently started using the 3.5 framework and was hit by a lightning.
> Could the FirebirdConnection object get a public "ReaderWriterLockSlim"
> member? It would be just about one line of code (definition ...), and
> would be sort of a workarround for anyone like me, who can wrap connection
> operations in try/catche/finally blocks.

I don't know how the RWLockSlim relates to try/catch/finally. Anyway
having any kind of lock of anchor for locking isn't going to do thread
safe provider. The FbTransaction, FbCommand etc. have methods
operating with database, hence you can easily screw something up if
you don't do locking properly. And you can do the locking properly (in
fact it's more likely, than relying on part of client) if *you* do
yourself. Also take into account, that isn't adhere to ADO.NET design.

BTW the RWLockSlim isn't good for this purpose, as in 99,999% cases
you need mutual exclusion (aka everybody is writer) because you don't
know (and shouldn't know) what's going on in lower layers. Also notice
how an application will scale if more threads will be using one
connection. It will be very bad. It's a similar story as thread vs.
threadpool and the solution is (un)surprisingly similar.

On the other hand, you can grab sources and add the member yourself,
if you think you need it.

-- 
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.cincura.net/ | http://www.ID3renamer.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to