Deadlock with Synchronize in TRVWordEnumThread (XE6)

General TRichView support forum. Please post your questions here
Sascha
Posts: 1
Joined: Wed Jun 19, 2019 9:35 am

Re:

Post by Sascha »

anovikov wrote: Sun Oct 05, 2014 6:47 pm
Sergey Tkachenko wrote: So, do you use thirdparty components, or may be your own code uses Synchronize?
I have emailed you the RVThread implementation with the atomic, volatile read/write to thread status.

I also added the unit that fixes the synchronization deadlock universally. I inherited your RVThread from TSynchronizedThread and replaced CheckSynchronize by SyncOrAbort implemented in the TSynchronizedThread unit. Please note that TSynchronizedThread has its own Synchronize() method implementation so it uses a different mechanism to synchronize with the Main Thread that helps avoid the deadlock.

BTW I did not have time to fully test this new unit in your case (it just works for now and I have other things to do), but you might want to run different tests on to ensure this mechanism solves this problem without creating new issues.

You can go ahead and add this to your library if it works for you in the end as the fix.
Even though it's been a while:
The solution sounds relatively promising. Unfortunately, this has not been discussed here.
Since we have the same problem and are very interested in a solution, we would like to know whether the changes solve the problem.

Thank you in advance
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Deadlock with Synchronize in TRVWordEnumThread (XE6)

Post by Sergey Tkachenko »

Can you send me a call stack of the main process when the application freezes? (if you need instructions, let me know).
I am quite sure that TRichView code cannot lead to deadlocks by itself, but some third-party code that calls Synchronize probably may cause it.
Post Reply