[Stackless] atomic

Alberto Ganesh Barbati AlbertoBarbati at libero.it
Mon Sep 15 23:44:04 CEST 2008


Richard Tew ha scritto:
> On Sat, Sep 13, 2008 at 2:15 PM, Nicolas Stein <n.stein at internike.com> wrote:
>> Am I right in assuming that, if I never use preemptive scheduling, I
>> never need to use "...set_atomic(True)...",
>> to guarantee the atomicity of the middle block ?
> 
> Yes.
> 

By the way, will stackless provide context manager for atomicity to be
used in the "with" statement? I mean, wouldn't it be good to be able to
write:

  with stackless.atomic():
    your_code_here()

instead of:

  t = stackless.getcurrent()
  flag = t.set_atomic(True)
  try:
    your_code_here()
  finally:
    t.set_atomic(flag)

I know it's not difficult for a user to write such a context manager,
but it would be nice to have it provided by stackless itself.

Same thing, possibly, for set_ignore_nesting().

Just my 2 eurocent,

Ganesh





More information about the Stackless mailing list