Welcome to the main channel on the development of MoarVM, a virtual machine for NQP and Rakudo (moarvm.org). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
06:41 sena_kun joined
lizmat Q: can you thread-safely ask for the nqp::elems(hash) while it is being changed by another thread ? 12:24
jdv how would that make sense? my naive guess is no unless the hash is one of those fancy concurrency safe ones which nqp/moarvm hashes are not. 13:14
lizmat it would make sense for a progress indicator 13:16
and it would be helpful if a lock wouldn't be needed 13:17
ugexe reads must be protected if writes can occur 15:53
lizmat but is that also right for the "elems" value of a hash? 16:01
or is that not an int in a struct somewhere ?
ugexe m: use nqp; my %hash; my $p = start { for 1..Inf { %hash{$_} = 1 } }; for 1..Inf { say nqp::elems(%hash) } 16:09
camelia (signal SEGV)
ugexe m: use nqp; my %hash; my $p = start { for 1..Inf { %hash{$_} = 1 } }; sleep 1; for 1..Inf { $ = nqp::elems(%hash) } 16:10
camelia MoarVM oops: MVM_str_hash_count called with a stale hashtable pointer
at <tmp>:1 (<ephemeral file>:)
from <tmp>:1 (<ephemeral file>:<unit>)
from <tmp>:1 (<ephemeral file>:<unit-outer>)
from NQP::src/HLL/Compiler.nqp:196 (/home/cameliā€¦
lizmat I guess that answers that question, thanks :-) 16:11
21:17 rypervenche left 21:39 rypervenche joined 22:41 sena_kun left