Skip to content

[FEAT] Investigate Thread<T> proxies, transferable object API #68

@JaimeGensler

Description

@JaimeGensler

Describe the problem this feature solves

Proxies may be a cleaner way to handle our threading solution - rather than passing a string name for the function, getting an object that's a proxy with those properties on it would be neat.

Our threading solution also needs some sort of way to handle transferable objects.

Describe the solution you'd like to see

Option 1 (Transferable Wrapper)

This is how threads.js handles this. If you want to transfer an object, you can wrap it in a Transfer() call - this call and how it works should be opaque.

function mySystem(thread: Thread<T>) {
  thread.myFunc(Thread.transfer(someTransferableObject));
}

For implementation, this could either be a wrapper that must be unwrapped by the proxy handler, or simply push a value into a local array.

Option 2 (Transferable Argument)

Add a final argument that accepts transferable objects.

function mySystem(thread: Thread<T>) {
  thread.myFunc(someTransferableObject, [someTransferableObject]);
}

Not sure how to differentiate between normal arguments and transfers in this case, though

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions