[MUD-Dev] Atomic functions

KevinL darius at bofh.net.au
Wed Nov 15 15:12:17 New Zealand Daylight Time 2000


>>> "Felix A. Croes" wrote
> KevinL <darius at bofh.net.au> wrote:
> 
> >[...]
> > Can I ask, because I started to look at the code, but it looks to be a fun 
> > thing to unravel, how it'd deal with the following (rather pathologic) bit 
of 
> > code?
> >
> > if str < 10
> >     str = str * 3
> > else:
> >     str = str * 2
> >
> > (using pythonic layout 'cause it's easier ;)
> >
> > Say this is part of a spell, to raise someone's strength (to give it that n
ice 
> > muddy flavour).  It's cast by two people, A and B, on a third, C.  The 
> > timeslicing does the following, for some strange reason:
> >[remainder of example snipped]
> 
> Perhaps I am being dense -- but what does this have to do with atomic
> functions, as I described them?

Ok, I was working on the theory that your atomic functions would help because 
you could manage rollback if things went wrong - in particular around things 
like moving, where you might want to check the state of a few things "at 
once".  I've been trying to bundle that move trick (which I face also - two 
updates for a single move) and the above problem in as a single issue - how do 
I deal with state changing out from under a process while it's happening.  
Maybe they're different problems.

> It is true that with threads running in parallel, a rollback in one
> thread could have arbitrary results in another, which is why I
> stipulated that threads must run sequentially (or at worst,
> competitively in C&C fashion).

Ok, by sequentially, you mean you're only running one thread at a time?  Why 
thread then?  And if you're doing that, how can you ever have problems?  Maybe 
I misunderstand - can you define 'sequentially' in small words for me? :)

Oh, ok, I've just read Christopher Allen's response - atomic functions are 
just a way to say "if anything happens, kill this (and restart?  Or just 
restore state?)", right?  But you don't pick up things like the "another
thread got in between check and change", you just pick up actual breakages.
Ok, I misunderstood - I thought this was a way to do something else ;)

Don't mind me, I'll get back in my box ;)

KL




_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the MUD-Dev mailing list