Subject Re: [ib-support] Re: Can anyone help: Error reading data from the connection
Author Martijn Tonies
> >>>At this point another thread may
> >>>acquire this db handle. Is this safe?
> >>
> >>
> >>No. Start each thread and create the db handle within the thread.
> >>
> >>You need to think about keeping a pool of threads and letting each
> >>thread signal when it is ready for new work.
> >
> >
> > Why is this different? Or actually, why doesn't the other approach work?
> >
>
> In the first approach a pool of database handles are created in
> (presumably) the main thread and a handle is passed to a worker thread
> as required. This is the crux of the problem. The current library is
> only thread safe if the database handle is created and used within the
> same thread.

So the connection handles have a context of the thread?

Weird... ah well - I've always done the connection/thread thing...


With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."