lua-users home
lua-l archive

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


Title: Grupo Hasar
Ah, I see, I'd missed the value-passing issue. This obviously requires that the calling coroutine waits for the called one to yield.

Thanks,
Hugo

David Kastrup escribió:
Hugo Etchegoyen <hetchegoyen@hasar.com> writes:

  
IMHO a non-preemptible thread and a coroutine (at least the kind of
coroutines you are talking about, which have a private stack) are
the same thing.
    
This would hold at best on single processors: on multiple processors,
several threads can run simultaneously unpreempted.  However,
coroutines, being strictly synchronized, can have something that
threads in general don't: they can pass values.  Yielding in a Lua
thread will both pass and accept a value to and from the controlling
Lua thread.  This is obviously only possible when the caller is
suspended until the called thread yields.  Apart from the switching of
the stacks, this is completely identical to function calls.

  

--

Ing. Hugo Eduardo Etchegoyen
Gerente Dto. Software de Base

Compañía Hasar | Grupo Hasar
Marcos Sastre y José Ingenieros
El Talar. Pacheco
[B1618CSD] Buenos Aires. Argentina
Tel [54 11] 4117 8900 | Fax [54 11] 4117 8998
E-mail: hetchegoyen@hasar.com
Visítenos en:
www.hasar.com
Información legal y política de confidencialidad: www.grupohasar.com/disclaimer