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

Improve thread pool invocation #1661

Open
tshemsedinov opened this issue Sep 19, 2021 · 2 comments
Open

Improve thread pool invocation #1661

tshemsedinov opened this issue Sep 19, 2021 · 2 comments

Comments

@tshemsedinov
Copy link
Member

tshemsedinov commented Sep 19, 2021

New syntax:

const result = await domain.module1
  .doSomething(args)
  .thread({ exclusive: true });
@tshemsedinov tshemsedinov self-assigned this Sep 19, 2021
@tshemsedinov tshemsedinov changed the title Improve thread pool invokation Improve thread pool invocation Oct 12, 2021
@georgolden
Copy link
Member

Questions:

  • If we do a wrapper for all domain and lib functions that will force us to use async/await syntax everywhere. Should we wrap all functions to thenable in our case (similar wrapper Procedure has been done for api)?
  • How are we supposed to keep some function unwrapped with this syntax?
  • Thenable is not a Promise. How we are supposed to distinguish thenable and promise?

Example:

We have sync function here let it be lib/array/timesTen.js

(array) => array.map((el) => el*10)

If I want to just invoke this function inside my code that will look like this:

async ({ array }) => {
  return await lib.array.timesTen(array);
}

@tshemsedinov
Copy link
Member Author

tshemsedinov commented Oct 19, 2021

We will wrap just async functions, to call timesTen from another thread you need
async (array) => array.map((el) => el * 10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants