Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename Tap 'on_close' to 'closing'
  • Loading branch information
lizmat committed Apr 21, 2014
1 parent 257d0cd commit 40c3799
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/core/Supply.pm
Expand Up @@ -9,7 +9,7 @@ my role Supply {
has &.more;
has &.done;
has &.quit;
has &.on_close;
has &.closing;
has $.supply;
method close() {
$!supply.close(self)
Expand All @@ -19,8 +19,8 @@ my role Supply {
has @!tappers;
has $!tappers_lock = Lock.new;

method tap(&more = -> $ { }, :&done, :&quit = {.die}, :&on_close) {
my $sub = Tap.new(:&more, :&done, :&quit, :&on_close, :supply(self));
method tap(&more = -> $ { }, :&done, :&quit = {.die}, :&closing) {
my $sub = Tap.new(:&more, :&done, :&quit, :&closing, :supply(self));
$!tappers_lock.protect({
@!tappers.push($sub);
});
Expand All @@ -31,8 +31,8 @@ my role Supply {
$!tappers_lock.protect({
@!tappers .= grep(* !=== $t);
});
if $t.on_close -> &on_close {
on_close();
if $t.closing -> &closing {
closing();
}
}

Expand Down Expand Up @@ -169,7 +169,7 @@ sub on(&setup) {

method tap(|c) {
my @to_close;
my $sub = self.Supply::tap(|c, on_close => { .close for @to_close });
my $sub = self.Supply::tap( |c, closing => {.close for @to_close});
my @tappers = &!setup(self);
my $lock = Lock.new;

Expand Down
18 changes: 9 additions & 9 deletions src/core/SupplyOperations.pm
Expand Up @@ -39,7 +39,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $closed = False;
my $sub = self.Supply::tap(|c, on_close => { $closed = True });
my $sub = self.Supply::tap(|c, closing => { $closed = True });
$!scheduler.cue(
{
for @!values -> \val {
Expand All @@ -66,7 +66,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $cancellation;
my $sub = self.Supply::tap(|c, on_close => { $cancellation.cancel() });
my $sub = self.Supply::tap(|c, closing => { $cancellation.cancel() });
$cancellation = $!scheduler.cue(
{
state $i = 0;
Expand All @@ -88,7 +88,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $source_tap;
my $sub = self.Supply::tap(|c, on_close => { $source_tap.close() });
my $sub = self.Supply::tap(|c, closing => { $source_tap.close() });
$source_tap = $!source.tap( -> \val {
self!more(val.flat)
},
Expand All @@ -115,7 +115,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $source_tap;
my $sub = self.Supply::tap(|c, on_close => { $source_tap.close() });
my $sub = self.Supply::tap(|c, closing => { $source_tap.close() });
$source_tap = $!source.tap( -> \val {
if (&!filter(val)) { self!more(val) }
},
Expand All @@ -138,7 +138,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $source_tap;
my $sub = self.Supply::tap(|c, on_close => { $source_tap.close() });
my $sub = self.Supply::tap(|c, closing => { $source_tap.close() });
my &more = do {
if &!with and &!with !=== &[===] {
my @seen; # should be Mu, but doesn't work in settings
Expand Down Expand Up @@ -199,7 +199,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $source_tap;
my $sub = self.Supply::tap(|c, on_close => { $source_tap.close() });
my $sub = self.Supply::tap(|c, closing => { $source_tap.close() });
my &more = do {
my Mu $last = @secret;
my Mu $target;
Expand Down Expand Up @@ -237,7 +237,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $source_tap;
my $sub = self.Supply::tap(|c, on_close => { $source_tap.close() });
my $sub = self.Supply::tap(|c, closing => { $source_tap.close() });
$source_tap = $!source.tap( -> \val {
self!more(&!mapper(val))
},
Expand All @@ -264,7 +264,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $source_tap;
my $tap = self.Supply::tap(|c, on_close => { $source_tap.close() });
my $tap = self.Supply::tap(|c, closing => { $source_tap.close() });

my @batched;
sub flush {
Expand Down Expand Up @@ -300,7 +300,7 @@ my class SupplyOperations is repr('Uninstantiable') {

method tap(|c) {
my $source_tap;
my $tap = self.Supply::tap(|c, on_close => { $source_tap.close() });
my $tap = self.Supply::tap(|c, closing => { $source_tap.close() });

my @batched;
my $last_time;
Expand Down

0 comments on commit 40c3799

Please sign in to comment.