Hi,
On Thu, 3 Feb 2022 09:49:29 +1100
> Mitchell:
>
> > I'm very tempted to test this on both Win32 and macOS.
>
> There’s some possibility of it working on macOS as all Unixes have more in common than they do with Win32. I haven’t seen a definitive statement on macOS multithreaded Pango like the one about Win32 from the main Pango developer Behdad Esfahbod.
>
> The technique used for multi-threading Pango is to use thread-local resources and avoid locking. macOS and Linux share more threading infrastructure (like pthreads) so macOS may be able to reuse the Linux work unless it uses Linux-specific APIs. OTOH, macOS GTK seems to get even less attention than Win32 GTK.
For anyone using Scintilla GTK on Windows and/or macOS, I've experimented on both platforms with threading enabled and have not managed to induce a crash. I've been testing on macOS for a couple of weeks now with no adverse effects. This morning I hammered a 4-core Windows 10 VM by repeatedly joining lines in a 2600 line source file one line at a time until it was a single, 113000 character long line. (I did this in a split view too, with both Scintilla views displaying the same document.) After a few minutes at max CPU it was done. I then inserted newlines above the line and typed at the beginning of the massive line for good measure. No problem.
I also briefly explored the source of the Pango calls Scintilla is making to measure text widths and nothing jumped out at me as being non-thread-safe. I would not expect text drawing to be thread-safe, but just measuring could very well be.
I am going to patch out the #if fence around PlatGTK.cxx's "Supports::ThreadSafeMeasureWidths" in my application's copy of Scintilla. It's quite possible you can do the same.
Cheers,
Mitchell