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

ffi: different input and output types for tasks #3445

Open
jsha opened this issue Nov 24, 2023 · 2 comments
Open

ffi: different input and output types for tasks #3445

jsha opened this issue Nov 24, 2023 · 2 comments
Labels
A-ffi Area: ffi (C API) C-feature Category: feature. This is adding a new feature.

Comments

@jsha
Copy link
Contributor

jsha commented Nov 24, 2023

When documenting the FFI API (#3424), one thing I found confusing is that the *hyper_task type has two different purposes:

  1. It can be added to an executor to be polled.
  2. Eventually it will be returned from hyper_executor_poll.

For (2), it will have a type and a value. For (1), it won't yet have a value. Will it have a type?

For (2), is it possible to put the same task back into the executor? I think the answer is no.

I think it would be clearer to split this into two types: *hyper_task, and *hyper_task_result, corresponding to (1) and (2) respectively.

@jsha jsha added the C-feature Category: feature. This is adding a new feature. label Nov 24, 2023
@seanmonstar seanmonstar added the A-ffi Area: ffi (C API) label Nov 24, 2023
@seanmonstar
Copy link
Member

Hm, I see what you mean. Separating the types would make the distinction even clearer.

Is it worth it? It does seem like it'd require an extra allocation for every task, to box up the result separately.

Some other examples that I think of are like getting a CURL*, and then passing it to perform(), and then afterwards it has extra stuff in it.

@jsha
Copy link
Contributor Author

jsha commented Nov 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ffi Area: ffi (C API) C-feature Category: feature. This is adding a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants