Subject | RE: [IBO] What's the right way of using threads with IBO? |
---|---|
Author | Paul Hope |
Post date | 2008-10-27T21:39:05Z |
Hi Alexandre
Create an ib_connection, ib_session and ib_dataset within the thread - or
make sure only one instance of the thread can run at any time and let it use
a dedicated set of the above. Every three seconds sounds a bit scary, if
one gets delayed they will start tripping over each other and end up in a
big pile.
I use FB events to notify change and fire off the thread to refresh the
data. I only allow one background thread to run, if another event comes in,
I start a timer, ignore any other events while the timer is running and run
the thread again at the end of the timer to mop up any new changes. You
will need to use read and write memory locks to pass data between the
threads.
HTH
Regards
Paul
Create an ib_connection, ib_session and ib_dataset within the thread - or
make sure only one instance of the thread can run at any time and let it use
a dedicated set of the above. Every three seconds sounds a bit scary, if
one gets delayed they will start tripping over each other and end up in a
big pile.
I use FB events to notify change and fire off the thread to refresh the
data. I only allow one background thread to run, if another event comes in,
I start a timer, ignore any other events while the timer is running and run
the thread again at the end of the timer to mop up any new changes. You
will need to use read and write memory locks to pass data between the
threads.
HTH
Regards
Paul
> -----Original Message-----
> From: IBObjects@yahoogroups.com
> [mailto:IBObjects@yahoogroups.com] On Behalf Of clatu_earth
> Sent: 26 October 2008 01:11
> To: IBObjects@yahoogroups.com
> Subject: [IBO] What's the right way of using threads with IBO?
>
> Hi fellows!
>
> This may be a newbie question but here it goes anyway... ;-)
>
> My application does a refresh of a query on a FB database
> every 3 seconds. This is to display a list of events on an IB_Grid.
>
> The refresh is done within the main thread of the aplication,
> then "freezing" it as long as the query is running.
>
> My question is: can I just put the refresh command inside a
> separate thread to liberate the aplication visual controls? I
> know that any code that update visual controls should be done
> inside a Synchronize() call, but can't figure out how to do it.
>
> Any help would be apreciated!
> Thanks!
> Alexandre
>
>
>
> ------------------------------------
>
> ______________________________________________________________
> _____________
> IB Objects - direct, complete, custom connectivity to
> Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ______________________________________________________________
> _____________
> http://www.ibobjects.com - your IBO community resource for
> Tech Info papers,
> keyword-searchable FAQ, community code contributions and more
> ! Yahoo! Groups Links
>
>
>