Open Rantanen opened 6 years ago
We might also want Mutex
there somewhere. All of this should be controlled by the #[com_class(..)]
attribute, ie:
#[com_class(IReadOnlyInterface, mut IWriteInterface, thread_safe)]
or
#[com_class(IReadOnlyInterface, mut IWriteInterface, mutex=true)]
or
#[com_class(IReadOnlyInterface, mut IWriteInterface, Sync)]
Currently the COM calls are skipping borrow checkers and there are no real safeties against calling multiple &mut self methods in parallel.
We should try to achieve the following:
&self
methods, the underlying type will beImmutableComClass
which has the type without aRefCell
. This allows more performant calls (no borrow checking). The user can use such types for immutable data or for performance critical mutable data at which point they are responsible for handling the mutable data with their own RefCells.&mut self
, the underlying type will beMutableComClass
which has the type within aRefCell
. This enables runtime borrow checking.This might need us to expand the
#[com_class]
attribute with something like#[com_class_mut]
or#[com_class(IReadOnlyInterface, mut IWriteInterface)]