kprotty / zap

An asynchronous runtime with a focus on performance and resource efficiency.
https://github.com/kprotty/zap
MIT License
399 stars 16 forks source link

Any ideas about cancellation? #12

Open Subuday opened 1 month ago

Subuday commented 1 month ago

As far as I understand, task structure should have some sort of is_canceled variable? And there should check before calling callback. What is your vision on cancelling process?

kprotty commented 3 weeks ago

Given task memory is intrusively provided, if it never invokes the callback due to a cancellation request then how can it free the Task? Furthermore, not all tasks are inherently cancellable (especially ones that must do so asynchronously or are blocking). I think users should implement their own cancellation if they need it. Would recommend a CancellationToken pattern if so.

Subuday commented 3 weeks ago

Thanks.

Subuday commented 3 weeks ago

Could you recommend some materials, blogs, etc about intrusively memory? I've never seen/used this...

Subuday commented 3 weeks ago

I mean only from got about this thing only from your post =) By the way, incredible work. Amazing deep dive in thread pool