[wxpython-users] Abort connecting to a database (threading)

Alastair Medford alastairmedford at gmail.com
Sat Sep 6 21:29:40 PDT 2008


Currently I'm trying to write code that will let me connect to a
database while have an option to cancel, since if the program cannot
connect to the database it takes a long time to timeout. I believe
threads are the best way to do this, but I'm a bit confused about how
to cause an abort. From the examples I've looked at,
(http://wiki.wxpython.org/index.cgi/LongRunningTasks ), it seems like
I have to make the second thread poll to see if an abort has occurred,
and then react from there. The problem is connecting to a database
doesn't involve a loop or anything, it's just running a single
function. Since this is the case, is there any other way to check for
an abort other than polling? Or is this just not possible? If it has
to be done via polling, the only way I can think of doing this would
be to edit the database library to check for an abort while it's
checking for a response from the database, which would be way beyond
my ability.

Thanks,
-- 
Alastair Medford


More information about the wxpython-users mailing list