develooper Front page | perl.perl6.language | Postings from June 2006

Re: Concurrency: hypothetical variables and atomic blocks

Thread Previous | Thread Next
Ruud H.G. van Tol
June 1, 2006 00:27
Re: Concurrency: hypothetical variables and atomic blocks
Message ID:
Darren Duncan schreef:

> Each time a context (a code block, either a routine or a syntactic
> construct like 'try' is) is entered that is marked 'is atomic', a new
> transaction begins, which as a whole can later be committed or rolled
> back; it implicitly commits if that context is exited normally, and
> it rollsback implicitly if the context exits with a 'fail' and/or due
> to a thrown exception.  (And yes, I see it as being easier to use if
> rollback and fail are generally joined at the hip.)

There are also 'lazy atomic' actions that may not achieve (yet) what
they are supposed to do (maybe the storage of some memory structure to a
disk file). So they sort of 'try' and then sort of 'fail', but they
shouldn't block continuation yet, because they will get another go at it
later on.

> One atomic context can contain another atomic context, so they are
> layered; if an outer layer rolls back, it results in any 'successful'
> inner layers also rolling back, so that everything which happened
> within the outer context has rolled back.

If the 'results' would be (for example) text data written to a logfile,
the 'roll back' could be (1) removal of the written data, or (2)
appending a line about the failure. But writing that last line can of
course also fail.

Groet, Ruud

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About