Created
October 5, 2021 15:52
-
-
Save dogbert17/20bd2f83e2c8082e57b3d23538bca6fa to your computer and use it in GitHub Desktop.
Test for bug
This file contains hidden or 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
my %objects; | |
my Lock $ol .= new; | |
class Bar { | |
submethod TWEAK (|) { | |
$ol.protect: { | |
my $obj-id = self.WHICH; | |
die "DUPLICATE FOUND: ", $obj-id if %objects{$obj-id}; | |
%objects{$obj-id} = True; | |
say $obj-id; | |
} | |
} | |
submethod DESTROY { | |
$ol.protect: { | |
my $obj-id = self.WHICH; | |
say "DESTROY ", $obj-id; | |
%objects{$obj-id}:delete; | |
} | |
} | |
} | |
my @p; | |
for 1..100 { | |
for 1..100 { | |
Bar.new; | |
@p.push: start { | |
# Bar.new; | |
sleep .01; | |
} | |
} | |
} | |
await @p; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment