Subject | Thread Safe? |
---|---|
Author | gsndelphicoder |
Post date | 2007-08-29T18:50:14Z |
Hello All,
I have developed a web application using Delphi 7, Intraweb 8.0.22,
IBO 4, & Firebird 1.5.
I am having an issue with my app not being thread-safe and I'm pretty
sure its in my data access. I did not realize until reading the IBO
FAQ that a TIB_Session was necessary to make the data access portion
of the app thread-safe. I have added a TIB_Session to my datamodule
and move it to be first in the creation order. I wanted to clarify
and make sure that is all I need to do. I was confused by a couple
responses post by Jason in the IBO FAQ:
"You need not only a connection for each thread but it is also a good
idea to have a TIB_Session for each thread. When the connection,
transaction and dataset components are created, make the session their
owner. This isolates each thread from other thread contexts.
If you do this then IBO is fully thread-safe."
and
"One thing to ensure is that each thread needs to create a TIB_Session
component. Then, when you create the other components, like the
TIB_Connection, make that TIB_Session instance the owner of the other
IBO components the thread uses.
Make sure the TIB_Session is FIRST in the creation order."
Like I said before, I have added a TIB_Session to my datamodule and
moved it to first in the creation list. What is meant by "when you
create the other components, like the TIB_Connection, make that
TIB_Session instance the owner of the other IBO components the thread
uses." ? Do I have more coding to do or is this automatically handled
by adding the TIB_Session to the datamodule and moving it to first in
the creation order? If I do have more coding to do, what would the
code look like?
There is no code resembling this assignment of the session as the
owner of the other IBO components in the Threads sample application?
Thanks All,
Branden Johnson
I have developed a web application using Delphi 7, Intraweb 8.0.22,
IBO 4, & Firebird 1.5.
I am having an issue with my app not being thread-safe and I'm pretty
sure its in my data access. I did not realize until reading the IBO
FAQ that a TIB_Session was necessary to make the data access portion
of the app thread-safe. I have added a TIB_Session to my datamodule
and move it to be first in the creation order. I wanted to clarify
and make sure that is all I need to do. I was confused by a couple
responses post by Jason in the IBO FAQ:
"You need not only a connection for each thread but it is also a good
idea to have a TIB_Session for each thread. When the connection,
transaction and dataset components are created, make the session their
owner. This isolates each thread from other thread contexts.
If you do this then IBO is fully thread-safe."
and
"One thing to ensure is that each thread needs to create a TIB_Session
component. Then, when you create the other components, like the
TIB_Connection, make that TIB_Session instance the owner of the other
IBO components the thread uses.
Make sure the TIB_Session is FIRST in the creation order."
Like I said before, I have added a TIB_Session to my datamodule and
moved it to first in the creation list. What is meant by "when you
create the other components, like the TIB_Connection, make that
TIB_Session instance the owner of the other IBO components the thread
uses." ? Do I have more coding to do or is this automatically handled
by adding the TIB_Session to the datamodule and moving it to first in
the creation order? If I do have more coding to do, what would the
code look like?
There is no code resembling this assignment of the session as the
owner of the other IBO components in the Threads sample application?
Thanks All,
Branden Johnson