Thanks Roberto,
So we will have to split our code into different apps then.
We cannot just do something like that :
local function one()
--do something long running (5s)
return res
end
local function two()
--do something fast
return res
end
local c,d = one,two
-- here spawn means execute
local e = c.spawn
local f = d.spawn
-- here readState means read the result or wait for it until it is done.
e.readState()
f.readState()
That way we could run in parallel inside the same app.
Is this behavior possible ?
Thanks
> Date: Fri, 25 Apr 2014 07:32:29 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: [uWSGI] Threads in lua ?
>
>
> > Hello,
> >
> > I am not sure to understand : Lua is not multithreaded but uses
> > coroutines.
> > I would not rely on libraries to provide the parallel tasking (lanes,
> > llthread and so on) because of internal policies.
> >
> > Yes, dumb but..
> >
> > Will uwsgi help us in this field for lua ?
> >
> > I thought about a rpc thing with sqlite to save the evolution but it is
> > not that interesting the end, because when the functions will not finish
> > at the same time you have to sleep for an arbitrary time and it is not a
> > reliable strategy (what if I sleep for one second and the process finished
> > 100 ms after the sleep ? 900 ms lost.)
> >
> > I would like to spawn functions and get the whole result in the end.
> >
> > Thanks
> >
> >
> >
> > _______________________________________________
> >
>
> uWSGI will generate a lua_state for every thread (if run in multithreaded
> mode). So yes, with uWSGI you can have multiple threads running the same
> lua app (without shared state)... and thanks to caches, queues and locks
> (and rpc to some extent) uWSGI apis you can have shared states at various
> levels.
>
>
> --
> Roberto De Ioris
> http://unbit.it
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi