[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
Guillem Jara edited this page Oct 4, 2021 · 1 revision

Voila can be somewhat dangerous, because it lets you use the multi-thread power for doing stuff to your files, so it could cause a data race. Here comes the safety checker. It's not perfect but does (somewhat) good its job at spotting possible data races, but false positives are always possible, so if you encounter one please let us know, so we can fix it ASAP!

If the safety checker finds a possible data race, it will likely tell you which call is doing something while another one does stuff to the same file at the same time. So you can do 3 things:

Let's put as example this little script: @name ~= .*awesome_file { copy(@name, @parent/@name.x) move(@name, @parent/@name.y) }

  • Move operations to another cycle:
    • @name ~= awesome_file { copy(@name, @parent/@name.x); move(@name, @parent/@name.y) } First files will be copied and subsequently moved.
  • Move operations to another target:
    • @name ~= awesome_file { move(@name, @parent/@name.y) } @name ~= .*awesome_file.y { copy(@name, @parent/@name.x) } If the first operations modify files in a way we can't match anymore with the first conditional, we must add another target which would be able to match files with the new modifications applying then the desired operations.
  • Use the unsafe keyword on one of the functions (just if you're sure of what you are doing):
    • @name ~= awesome_file { unsafe copy(@name, @parent/x) move(@name, @parent/y) } In this particular case, it doesn't have why to cause a data race, as the file system should be smart enough for dealing with that.
Clone this wiki locally