Closed milibopp closed 8 years ago
StmControlBlock
was really ugly.
You replaced the two Option
s in LogVar
with an enum and I think that changes the behavior when a Var
is read and written.
Jep,
let x = var_ref.read();
thread::sleep(Duration::from_millis(200));
var_ref.write(x+10);
doesn't behave the way it should. I added another unit test to master branch.
Oops, I was afraid something would break, when I did that, but it seemed like the logic could be transformed to be an enum. Let me redo this step.
Three states read (with original value), write (with new value) and both, where read can be upgraged, are actually needed. I considered having independent optionals easier than dispatching on two possible types every time.
Yes, I think it's safer to exclude the empty case at compile-time, when it is not needed.
Not quite sure about the name of
StmControlBlock
now that I moved it. Generally, it looked like there were some encapsulation issues, so I went ahead to integrate it into the log.