SharedPointer<T> class
abstract
Base class for a dart:ffi
Pointer that can be shared between Isolate
s.
To share this points just send to the other Isolate
the SharedPointer.address.
Then in the other Isolate side just call SharedPointerAddress.getPointer,
to have the working SharedPointer instance.
Note that a ffi.Pointer
originally can't shared between Isolates, but
sharing the pointer address allows the same memory are to be acessed
simultaneously by different Isolate
. For now there's no mutex
implementation
to allow control of the owner thread
of the SharedPointer.
- Implemented types
- Implementers
Constructors
Properties
- address ↔ SharedPointerAddress
-
latefinal
- endian → Endian
-
The
endianness
of this pointer.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Returns
true
if this instance is closed (in the current Isolate).no setter - isInitializer → bool
-
Returns
true
if this instance is the initializer instance, that actually allocated the pointer. Only the initializer instance can free the pointer.no setter -
Forces serialization and deserialization even when SharedData.noSerializationOnDartNative is
true
.no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
checkClosed(
) → void - Checks if the instance is NOT closed, or throws a StateError.
-
computeSignature(
) → String -
Computes the signature of this instance.
override
-
copy(
) → SerializableData< SharedPointer< T> , SharedPointerAddress> -
Creates a copy of this instance.
inherited
-
deserialize(
SharedPointerAddress serial) → SerializableData< SharedPointer< T> , SharedPointerAddress> -
Deserializes
serial
to a instance of this type.inherited -
deserializeData(
SharedPointerAddress serial) → SharedPointer< T> -
Deserializes
serial
toD
.inherited -
free(
) → void -
Closes this instance and calls
malloc.free
for the Pointer if this is the initializer instance. See isInitializer. -
instantiate(
SharedPointer< T> data) → SerializableData<SharedPointer< T> , SharedPointerAddress> -
Creates a new instance with
data
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
) → T? -
Reads a
value
from the Pointer memory. -
readNewValue(
{T? lastValue, Duration? interval, Duration? timeout, bool acceptsNullValue = true}) → FutureOr< T?> -
Reads a new
value
, different fromlastValue
, performing a pooling withinterval
(default: 10ms) and atimeout
(default: 10s) that checks for a new value if needed. -
serialize(
) → SharedPointerAddress -
Serializes this instance to
S
.override -
toString(
) → String -
A string representation of this object.
inherited
-
write(
T value) → void -
Writes a
value
to the Pointer memory.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited