Up to Main Index                         Up to Journal for September, 2017

                   JOURNAL FOR THURSDAY 7TH SEPTEMBER, 2017
______________________________________________________________________________

SUBJECT: Changes out fixing data races at long last
   DATE: Fri  8 Sep 00:24:09 BST 2017

I’ve just pushed some changes to the public dev branch fixing what I hope is
the last of the data race issues. I’m still running additional testing and
Mikołaj has kindly offered to run some additional testing as well.

All I can say is “Phew!”, getting this far has been… a challenge. Still, I’ve
managed it and kept the BRL (Big Room Lock) mechanism in place which continues
to keep locking simple and mostly automatic.

As readers who follow the journal will know most of the data races stem from
implementing resets and respawning. There were other data races that were
found along the way which have also been fixed.

So what was the main issue? The main issue was that locking is performed at
the room level — or more precisely at the top level Inventory in a hierarchy
of Inventory, which is usually a room or location. Everything in the world is
somewhere and so everything can be locked with a BRL.

Except during a reset.

During a reset an item is taken out of the world and so is out of play. As it
is not in the world there is no BRL available to lock the item when it resets
and needs putting back in play and into the world. This leads to the data
races.

To solve this problem Inventory types now have a disabled list. Items can be
disabled which moves them from the Inventory content list to the disabled
list. Disabled items are then out of play. Items can be brought back into play
by enabling them which moves the item from the disabled list back to the
content list. This means an item can be out of play and still covered by a BRL
for locking.

All of this is now working, but the Inventory type could do with being cleaned
up somewhat — my priority was to get things fixed first. Ultimately the goal
is to only allow items to be added or removed from the world via the disabled
lists. When items are in the world and enabled they can only be moved from
Inventory to Inventory, not added or removed as can happen now. This would
make the interface for Inventory types cleaner and simpler and also simplify
the code in places — such as the Inventory Move method. The JUNK command is
also in a bit of a state at the moment and needs cleaning up — but that will
require implementing commands as types, at the moment commands are simply
functions.

For now I’m simply happy to have reached this point and think I should turn my
attention to putting out a very overdue release.

--
Diddymus


  Up to Main Index                         Up to Journal for September, 2017