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

Cancelable tasks and object pools #333

Closed
wants to merge 1 commit into from
Closed

Conversation

fzyzcjy
Copy link
Owner

@fzyzcjy fzyzcjy commented Feb 12, 2022

  • cancellable tasks
  • object pools (dependent of cancellable task)

Fix #241
Fix #242

@fzyzcjy
Copy link
Owner Author

fzyzcjy commented Feb 12, 2022

Current status: need some work to make it compile...

Main problem to consider: In my private repo api.rs I have the following code and let frb generate everything for me. However, now since it is extracted into frb itself, I need to reconsider how to write this code.

#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct CancelTokenHandle(pub i64, pub i64);

impl_pool_object_handle!(Arc<CancelToken>, CancelTokenHandle);

pub fn cancel_token_new(sub_pool_id: i64) -> Result<CancelTokenHandle> {
    Ok(pool::put(sub_pool_id, Arc::new(CancelToken::new())))
}

pub fn cancel_token_cancel(cancel_token: CancelTokenHandle) -> Result<()> {
    let cancel_token = pool::get_cloned(cancel_token)?;
    cancel_token.cancel();
    Ok(())
}

pub fn cancel_token_remove(cancel_token: CancelTokenHandle) -> Result<()> {
    pool::remove(cancel_token);
    Ok(())
}

@stale
Copy link

stale bot commented May 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 8, 2022
@sagudev
Copy link
Contributor

sagudev commented May 8, 2022

👀

@stale stale bot removed the wontfix This will not be worked on label May 8, 2022
@fzyzcjy
Copy link
Owner Author

fzyzcjy commented May 8, 2022

@sagudev You are welcomed to make a PR to make this work :) Because I have already done the main things, and the blocking issue is #333 (comment)

@sagudev
Copy link
Contributor

sagudev commented May 8, 2022

👀

I did this just to prevent stale.

@lattice0
Copy link
Contributor

lattice0 commented Jul 9, 2022

👀

@fzyzcjy
Copy link
Owner Author

fzyzcjy commented Jul 9, 2022

@lattice0 Feel free to implement :) #333 (comment)

@stale
Copy link

stale bot commented Nov 7, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 7, 2022
@stale stale bot closed this Nov 14, 2022
@LowLevelSubmarine
Copy link

Is there any chance, that cancelable tasks will be implemented in the near future?

@fzyzcjy
Copy link
Owner Author

fzyzcjy commented Nov 5, 2023

@LowLevelSubmarine You can copy-and-paste it into your api.rs currently!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Vote to make it open-source] Cancelable tasks [Vote to make it open-source] Object pools
4 participants