Skip to content

added option to choose thread to run callbacks in. defaults to main#23

Open
spaul5 wants to merge 1 commit into
cbguder:masterfrom
spaul5:add-thread-choice
Open

added option to choose thread to run callbacks in. defaults to main#23
spaul5 wants to merge 1 commit into
cbguder:masterfrom
spaul5:add-thread-choice

Conversation

@spaul5

@spaul5 spaul5 commented Apr 24, 2019

Copy link
Copy Markdown

No description provided.

@cbguder

cbguder commented Apr 25, 2019

Copy link
Copy Markdown
Owner

Thanks for the PR!

It feels like this should not be the concern of the promise library, but maybe I'm missing something. What's the use case for this? Can this not be handled in the callback like:

client.getValue().then { value in
    queue.async {
        doStuff(value)
    }
}

Also, even if there is a good use case, the queue being an argument to resolve feels backwards. Imagine your API client returning a future to a controller, and resolving the future later. I would argue the controller should decide where to handle the callback, not the API client. Fixing this would likely require storing a reference to the queue alongside the callbacks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants