MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Mutual Exclusion



>>Basically, all you need to ensure is that you do not suspend between
>>reading the variable, and writing to the variable, and all is well :^)

>I don't think you're right here. I suppose there is some kind of scheduler in
>the moo-server, and it just can occur that the two verbs are being
>executed at the same time.

No, it is not possible for two verbs to be executing at the same time.  It is
possible for a task to suspend itself, permitting another task to run, and then
to resume its operation later.  In this case the programmer must have included
code which performs this function.  For example, the programmer could have
included a call to read() or suspend(), or could have fork()ed a portion of
the code off.

If you have a code segment which looks like this:
  this.foo = 1;
  this.bar = this.foo;
there is ABSOLUTELY NO WAY that this.bar could fail to equal 1, unless the task
crashes.  Once a task starts, it continues until it finishes, crashes, or
suspends.

Seth / Blackbriar
----------------------------------------------------------------------
Seth I. Rich
Woo, woo!  OpalMOO's back!       There is nothing more precious than
Rabbits on walls, no problem.    a tear of true repentance.




Home | Subject Index | Thread Index