[MUD-Dev] atomic functions

Felix A. Croes felix at xs1.simplex.nl
Thu Apr 30 03:59:20 CEST 1998


Having recently completed the implementation of the generic parsing
utility that I posted about earlier, I am now preparing to convert
my server to the lockless multithreading paradigm put forward on this
list by J.C. Lawrence.

It has occurred to me that the commit-or-fail idea can be applied to
parts of threads as well as entire threads, leading to the following
concept of "atomic functions":

    An atomic function is a function that succeeds or fails as a
    whole.  Any runtime error that is not caught within the function
    will lead to the entire function call, with all its effects
    and side-effects, being undone.

Atomic functions would be used to enforce consistency -- just like a
thread either fails or succeeds without leaving the mud in an
inconsistent, half-completed state.  Of course, every function called
at the beginning of a thread is effectively called atomically, so
code that depends on atomic functions can be replaced by code that
depends on (atomic) threads.  The advantage of atomic functions
would be to place the function call within the wider thread
context, which would be similar to imposing an execution order on
threads.  Also, calls to atomic functions could be nested.

Comments?  Is anyone already using this for his own server?

Felix Croes

--
MUD-Dev: Advancing an unrealised future.



More information about the mud-dev-archive mailing list