BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Threading and IBX

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express)
View previous topic :: View next topic  
Author Message
Marc Rohloff [TeamB]
Guest





PostPosted: Wed May 02, 2007 4:47 am    Post subject: Threading and IBX Reply with 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.

Is there anything else I need to know?

--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com
Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Wed May 02, 2007 7:07 pm    Post subject: Re: Threading and IBX Reply with quote



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





PostPosted: Wed May 02, 2007 11:03 pm    Post subject: Re: Threading and IBX Reply with quote



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





PostPosted: Thu May 03, 2007 11:08 pm    Post subject: Re: Threading and IBX Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.