Subject Re: [ib-support] Multithreading and GDS32.DLL (IB5.6)
Author lester@lsces.co.uk
> Will it be safe if I first make an Interbase api call for
> a db connection with thread A and when that has returned
> I later make call for the same db connection with thread B,
> taking care that there is only a single call in execution
> for a connection? In other words is there some thread
> affinity built into gds32.dll that requires using the very
> same thread for all calls dealing with a particular db
> connection?

I think the problem is related to 're-entrant' code. ( And I
stand to be corrected )

That is if two threads are running and doing things at the
same time, they can get their data mixed up, so that packets
back for one query can be fed by mistake to the other. So if
you ensure that there are two different connections for the
two queries, then the problem is prevented.

If you have some other way of ensuring that only one enquiry
is active at a time, you MAY not have a problem, the
difficulty comes when windows stops running on thread,
because it is waiting for and answer, and starts running the
other thread to see if the previous action has finished.
Windows is not very consistant on HOW it does this so
designing round it has to be very robust.

If there is any chance that two enquiries are running at
once, you need the two connections.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services