Python Forum
[PyQt] SSH port forwarding and connection to SQL Server in separate threads freezes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] SSH port forwarding and connection to SQL Server in separate threads freezes
#4
Keep in mind that when running QThreads or even Python Threads you are dealing with the Python GIL (look it up if you are not familiar with it) but in a nutshell this simply means while you have Threads these threads are all run linearly such that only one operation (thread) is being executed at a time. So if you have 2 Sub-Threads and the Main Thread (QApplication) then if you launch anything within in any one of these 3 Threads that is a continuous process nothing else is going to be able to do anything until that continuous process finishes or you some how pass control back the the Event Handler Thread (QApplication)

So when designing Threads within Python you must keep this in mind, if your program seems to freeze this is because you have locked out (or blocked) the Event Handler from doing its job -- however all those events still stack up within the Event Queue such that once the Event Handler gets back control it will process every Event that was Queue up.

So in a secondary nutshell if you want your GUI (which must be in a Main Thread - QApplication) to be viable while you do things in other aspects of your program you need to create a Multiprocess and put the GUI in one process and everything else in the other process or create more than one Multiprocess and put everything within its own process
Reply


Messages In This Thread
RE: SSH port forwarding and connection to SQL Server in separate threads freezes - by Denni - Nov-04-2019, 05:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  GUI freezes while executing a callback funtion when a button is pressed abi17124 5 7,671 Jul-10-2019, 12:48 AM
Last Post: FullOfHelp
  [Tkinter] tkinter freezes by clicking button Zatox11 33 26,495 Apr-10-2018, 09:03 AM
Last Post: Zatox11
  Running telnet loop freezes GUI reedhallen 1 3,525 Jan-27-2018, 10:24 PM
Last Post: j.crater
  Clock freezes - wx.python glib problem strongheart 3 4,147 Oct-10-2017, 03:36 AM
Last Post: strongheart

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020