-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The design of Donald::Select makes use of Donald::Callback objects, which are objects conainting a sub and call arguments. However, because of the pattern sub do_something_later() { my ($cb_or_sub,@args)=@_; $store_callback_somehere=new Donald::Callback($cb_or_sub,@args); } do_something_later(\&callback,$arg1,$arg2) the caller doesn't have a reference to the Donald::Callback object, which makes its diffucult to identify it, e.g. to cancel the callback. We want to change the design to accept only references to subs as callbacks. Instead of passing arguments, we exepect the caller to make use of closures to pass data to the callback if needed. sub do_something_later() { my ($cb)=@_; $store_callback_somewhere=$cb; } do_something_later(sub{callback($arg1,$args)}); Instead of changing the API of Donald::Select, we import the code directly into clusterd to make the modifications here.
- Loading branch information
Showing
1 changed file
with
210 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters