| View previous topic :: View next topic |
| Author |
Message |
Marc Rohloff [TeamB] Guest
|
Posted: Wed May 02, 2007 4:47 am Post subject: Threading and IBX |
|
|
Can someone tell me the rules or point me to an article on how to
create multi-threaded apps using IBX?
Do I need to create a separate TIBDatabase and TIBTransaction for each
thread or can I share them and just create a query for each thread.
Is there anything else I need to know?
--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com |
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Wed May 02, 2007 7:07 pm Post subject: Re: Threading and IBX |
|
|
Marc Rohloff [TeamB]" <"on request wrote:
| Quote: | Can someone tell me the rules or point me to an article on how to
create multi-threaded apps using IBX?
Do I need to create a separate TIBDatabase and TIBTransaction for each
thread or can I share them and just create a query for each thread.
|
Marc, it depends on which version of InterBase you are using. Anything
before 7.x, you definitely need both a separate IBDatabase and IBTransaction
for every thread. As of 7.x, you still need a separate IBTransaction for
each thread, both those transactions can share a single IBDatabase.
--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"Reality is that which, when you stop believing in it, doesn't go
away." - Philip K. Dick |
|
| Back to top |
|
 |
Craig Stuntz [TeamB] Guest
|
Posted: Wed May 02, 2007 11:03 pm Post subject: Re: Threading and IBX |
|
|
Wayne Niddery [TeamB] wrote:
| Quote: | As of 7.x, you still need a separate IBTransaction for each thread,
both those transactions can share a single IBDatabase.
|
Theoretically. This capacity was added for asynchronous query
cancellation, and I wouldn't suggest using it for other reasons.
IB is *supposed* to be thread-safe on a connection. However, there
appear to be cases where this doesn't work. In particular, I could
never get cancellation to work reliably on a local connection for IB
PLANalyzer -- the server's CPU will spike and the call will block -- so
I've disabled it there.
Moreover, the TIBDatabase component itself is not designed to be
thread-safe.
I wrote a stress-testing application for testing concurrent use of the
component and haven't thus far managed to break anything, but I
wouldn't bank on it for anything beyond cancellation. I still think
using a separate TIBDatabase/connection per thread is the way to go.
--
Craig Stuntz [TeamB] ˇ Vertex Systems Corp. ˇ Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Borland newsgroup denizen Sergio González has a new CD of
Irish music out, and it's good: http://tinyurl.com/7hgfr |
|
| Back to top |
|
 |
Wayne Niddery [TeamB] Guest
|
Posted: Thu May 03, 2007 11:08 pm Post subject: Re: Threading and IBX |
|
|
Craig Stuntz [TeamB] wrote:
| Quote: |
I wrote a stress-testing application for testing concurrent use of the
component and haven't thus far managed to break anything,
|
This is all I'm really going by - I did the same and could not make it fail.
--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"The legitimate powers of government extend to such acts only as are
injurious to others. But it does me no injury for my neighbor to say
there are twenty gods, or no God. It neither picks my pocket nor breaks
my leg." - Thomas Jefferson |
|
| Back to top |
|
 |
|