Subject | Re: [IBO] IB & Threads |
---|---|
Author | Geoff Worboys |
Post date | 2001-10-22T08:22:12Z |
> Every thread has his own:<...>
> which will be created in the constructor of the objectDo you mean the thread object? Remember that when the thread
constructor executes you are still in the calling/main thread context.
Because of this any IBO components constructed in the thread
constructor will use the default IB_Session of the calling/main
thread.
This presumes you understand that every thread must have its own
TIB_Session instance. IBO will automatically create a new instance
for each new thread as/when required - but only when the requirement
occurs in the new thread context (which is not the constructor).
It is best to call a special function at the start of Execute which
constructs any IBO objects required. The Threads example in the
samples directory you will see an example of this, the datamodule used
by the thread is created in the Execute function - not the thread
constructor.
> If the IB-Server is on the same PC it works onlyThere is a bug in IB6 (and I think it still exists even in FB1) where
> if i start one thread wait for finish and then i
> start the second
local connections are not thread safe. To work around this setup
using TCPIP to the "localhost".
> IB-Server WI-V6.0.1I suggest using the FB1 beta 2 release. It seems at least as stable
has IB6.0.1 but also fixes many bugs - and I suspect it is the most
likely version to produce a fix for the thread safe issue.
HTH
Geoff Worboys
Telesis Computing