Gio.File and thread-safety (original) (raw)

Hi,

GLib doc recommends to duplicate Gio.Files when using them from another thread.

Is it necessary for APIs that don’t do I/O, like Gio.File.get_relative_path?

pwithnall (Philip Withnall) May 9, 2025, 9:53am 2

Yes, it is necessary, because those APIs may access private members of the GFile without locking. It’s more about that (for any of the GFile methods) than about being thread-safe with I/O. Being thread-safe with I/O is only one part of concurrency safety with I/O, because as well as other threads you have to interact concurrently with other processes.

system (system) Closed June 8, 2025, 9:58am 4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.