You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So shared structs work well if you restrict yourself to only shared objects in communications, the problem is a lot of host types aren't sharable but are serializable and/or transferable. It would be nice if we could integrate cleanly with such types within a shared object.
As a simple proposal for such behaviour I'd propose that there should be a host type SharedMessageQueue that itself is a shared object, but can enqueue/dequeue serializable and transferable objects.
As a simple toy example, this is how one could make simple shared canvas that can be written from any thread:
A simpler alternative API would be making available a shared wrapper around a single serialized value. i.e. Something like:
sharedstructSharedSerializedValue<T>{constructor(value: T,transferList: Iterable<Transferable>);// Deserializes the value on the current thread, effectively transfering it into the current thread, throws if already been called (even on another thread)get(): Promise<T>;}
One could then just put such wrappers in any queue, or such, that they so desire.
So shared structs work well if you restrict yourself to only shared objects in communications, the problem is a lot of host types aren't sharable but are serializable and/or transferable. It would be nice if we could integrate cleanly with such types within a shared object.
As a simple proposal for such behaviour I'd propose that there should be a host type
SharedMessageQueue
that itself is a shared object, but can enqueue/dequeue serializable and transferable objects.As a simple toy example, this is how one could make simple shared canvas that can be written from any thread:
The text was updated successfully, but these errors were encountered: