views:

29

answers:

1

I am considering utilizing Python to call various dlls that will perform things like accessing the LAN (on Windows) or making HTTP requests. These dlls might be poorly written and get stuck. My first question is, whether isolating these dll calls in Python threads will guarantee that the main Python thread will not get stuck? My second question is whether Python can kill a thread if the DLL gets stuck in an infinite loop?

I know that I could solve this by launching the dlls in its own processes, but I would prefer to only have a single process.

I could use the latest versions of Python.

+1  A: 

Your main thread will still be responsive if another thread is issuing a blocking call. Still, terminating a thread is never really clean and might leave a mess around. See the MSDN documentation for TerminateThread for that matter.

With the introduction of the subprocess module, what are your concerns when it comes to using multiple processes?

Jim Brissom
My concern with multiple processes is that it will look ugly if my client will open his/her task manager. The client will perceive that it is more difficult to administer.
David