Stop a query by setting the session for call back

I am desparately trying to find a good way to stop a query that is
running on a thread.  I put it on a thread because there could be
multiple queries running in my system.  Any of which may need to be
terminated by the user.  I found what I thought was a good way to do
it but ran into some snags.

I put my queries on the thread and then set up a call back.  However,
the callback only works on the current session.  So I set up a timer
loop through the sessions in progress and set the current session to
each.  That is:

    Sessions.CurrentSession := MySession;

Unfortunately, this will sometimes hang at this line of code until the
query completes.  Other times it seems to work.

Any one have any ideas?

Mark A. Rupert
mark_rup...@protelinc.com