Hi,
I pass a javascript message from my sub-process to my main application with SendProcessMessage(PID_BROWSER,....)
Now when I call anything like MessageDlg or try to show a form with TThread.Synchronize or TThread.Queue it hangs, I suspect this is a deadlock.
What can I do?
And to close the browser form, should this also be in Synchronize? (when I'm in the OnProcessMessageReceived method)
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
TThread Synchronize creates deadlock
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: TThread Synchronize creates deadlock
Hi,
According to the documentation, TThread.Synchronize suspends the execution of the current thread while the method is executed in the main thread.
http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TThread.Synchronize
CEF and Chromium don't expect this and some events may freeze the app if you call TThread.Synchronize inside them.
I would use TThread.Queue or send a custom Windows message to the main form to execute your method in the main application thread without locking the current CEF thread.
According to the documentation, TThread.Synchronize suspends the execution of the current thread while the method is executed in the main thread.
http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TThread.Synchronize
CEF and Chromium don't expect this and some events may freeze the app if you call TThread.Synchronize inside them.
I would use TThread.Queue or send a custom Windows message to the main form to execute your method in the main application thread without locking the current CEF thread.
-
- Posts: 14
- Joined: Mon Nov 30, 2020 6:37 am
Re: TThread Synchronize creates deadlock
Thanks, the Window messages do the trick.