File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ function Base.copy(p::Perm)
4747 if isdefined (p, :inv , :sequentially_consistent )
4848 inv_imgs = copy (@atomic (p. inv). images)
4949 q⁻¹ = typeof (p)(inv_imgs; check = false )
50- @atomic q. inv = q⁻¹
5150 @atomic q⁻¹. inv = q
51+ @atomic q. inv = q⁻¹
5252 end
5353 return q
5454end
@@ -59,11 +59,11 @@ function Base.inv(σ::Perm)
5959 @atomic σ. inv = σ
6060 else
6161 σ⁻¹ = typeof (σ)(invperm (σ. images); check = false )
62- # we don't want to end up with two copies of inverse σ floating around
63- if ! isdefined (σ, :inv , :sequentially_consistent )
64- @atomic σ . inv = σ⁻¹
65- @atomic σ⁻¹. inv = σ
66- end
62+ # this order is important:
63+ # fuly initialize the "local" inverse first and only then
64+ # update σ to make the local inverse visible globally
65+ @atomic σ⁻¹. inv = σ
66+ @atomic σ . inv = σ⁻¹
6767 end
6868 end
6969 return σ. inv
You can’t perform that action at this time.
0 commit comments