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(mpz-common): dummy executor #132

Merged
merged 1 commit into from
May 15, 2024
Merged

Conversation

sinui0
Copy link
Collaborator

@sinui0 sinui0 commented May 13, 2024

This PR adds a dummy executor that does nothing.

@sinui0 sinui0 requested review from themighty1 and th4s May 13, 2024 23:13
Comment on lines +74 to +97
async fn join<'a, A, B, RA, RB>(&'a mut self, a: A, b: B) -> (RA, RB)
where
A: for<'b> FnOnce(&'b mut Self) -> ScopedBoxFuture<'a, 'b, RA> + Send + 'a,
B: for<'b> FnOnce(&'b mut Self) -> ScopedBoxFuture<'a, 'b, RB> + Send + 'a,
RA: Send + 'a,
RB: Send + 'a,
{
let a = a(self).await;
let b = b(self).await;
(a, b)
}

async fn try_join<'a, A, B, RA, RB, E>(&'a mut self, a: A, b: B) -> Result<(RA, RB), E>
where
A: for<'b> FnOnce(&'b mut Self) -> ScopedBoxFuture<'a, 'b, Result<RA, E>> + Send + 'a,
B: for<'b> FnOnce(&'b mut Self) -> ScopedBoxFuture<'a, 'b, Result<RB, E>> + Send + 'a,
RA: Send + 'a,
RB: Send + 'a,
E: Send + 'a,
{
let a = a(self).await?;
let b = b(self).await?;
Ok((a, b))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be polled concurrently? Or doesn't it matter because it is only a dummy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really matter, probably better to do it sequentially to catch any potential deadlocks

@sinui0 sinui0 merged commit d324081 into threading-refactor May 15, 2024
@sinui0 sinui0 deleted the feature/dummy-executor branch May 15, 2024 15:33
sinui0 added a commit that referenced this pull request Jun 25, 2024
sinui0 added a commit that referenced this pull request Jun 25, 2024
xiangxiecrypto pushed a commit to xiangxiecrypto/mpz that referenced this pull request Jun 28, 2024
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.

3 participants