Make libspectrum thread-safe. Changes from BogDan Vatra in [#349].
Patches: #349
Wiki: Fuse 1.2.2 Release Plan
Wiki: Fuse 1.3.0 Release Plan
Wiki: Fuse 1.3.1 Release Plan
I think this is a very valuable patch - I would very much like to use a thread-safe libspectrum on the Mac in a number of places.
Does anyone have any comments or concerns about intoducing this patch?
@BogDan: could you add some more detail about the status and requirements from this patch?
Sorry for the slow reply, somehow I didn't seen it until now.
Thanks for the info BogDan.
I think this looks pretty good from reading and your description. I think I'd want to add a "standard" thread-enabled vtable before it went to the trunk, for fuse-utils etc. to be updated to use it too, and some updates to the libspectrum documentation but it looks OK to me as an initial patch given that real GLib already allows access to data structures from multiple threads as long as they are only manipulated by one so I think the fallback case is also reasonable.
I've slightly tidied the patch and comitted to branches/patches-356-threadsafe-libspectrum in [r5628].
Related
Commit: [r5628]
I had to move libspectrum_tape to header file, because I need to access the context filed from other .c files.
Regarding the changes I've done to myglib replacements, they were needed to protect it's internal data i.e. GSList is accessing free_list & allocated_list global vars in may places which might come from multiple threads. As you can see in buff2Image all the calls are happening in one thread, but there are multiple threads that are calling this function in the same time (buff2Image is reentran).
That's why I stongly belive that C++ is a better choice for libspectrum & FUSE ;-) std containers don't need any synchronisation ;-) .
Thanks, I think the remaining todo list for this change to be in trunk is the following points barring other comments/issues that arise:
Updated libspectrum threadsafe patch on top of 1.2.1 branch.
Addressed with alternate approach from BogDan in libspectrum:merge-requests#2