-
-
Notifications
You must be signed in to change notification settings - Fork 287
Deal with cross-thread access to user-defined GodotClass instances #18
Copy link
Copy link
Open
Labels
c: ffiLow-level components and interaction with GDExtension APILow-level components and interaction with GDExtension APIc: threadsRelated to multithreading in GodotRelated to multithreading in GodotfeatureAdds functionality to the libraryAdds functionality to the libraryhardOpposite of "good first issue": needs deeper know-how and significant design work.Opposite of "good first issue": needs deeper know-how and significant design work.
Metadata
Metadata
Assignees
Labels
c: ffiLow-level components and interaction with GDExtension APILow-level components and interaction with GDExtension APIc: threadsRelated to multithreading in GodotRelated to multithreading in GodotfeatureAdds functionality to the libraryAdds functionality to the libraryhardOpposite of "good first issue": needs deeper know-how and significant design work.Opposite of "good first issue": needs deeper know-how and significant design work.
Currently,
RefCellandi32are used to store user-definedGodotClassinstances and their reference counts:https://github.com/godot-rust/gdextension/blob/a64f22409e05d1353492fded4aa36a4b4e6b710d/godot-core/src/storage.rs#L15-L21
In a multi-threaded configuration of the engine, this may lead to unsoundness when the instances are accessed by GDScript or engine code. Noting that
GodotClassdoes not have aSendorSyncrequirement, this can be as simple as a non-Sendfield in the type.@Bromeon in Discord:
As prior art, the GDNative bindings deals with the problem with the user-data wrapper system.