Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JaimeGensler opened this issue Dec 3, 2023 · 0 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@JaimeGensler
Copy link
Owner

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

@JaimeGensler JaimeGensler added the enhancement New feature or request label Dec 3, 2023
@JaimeGensler JaimeGensler added the good first issue Good for newcomers label Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

1 participant