lua-users home
lua-l archive

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


> >>  - Code may loop forever, especially a 3rd party untrusted code,
> >> which you  may want to run by loading scripts
> > Execute that in a sandbox or using Lanes or both. Can mitigate it,
> > dunno if you can prevent it.
> 
> 
> I'll look into Lanes, sounds interesting.
> 
> BTW, out of curiosity, does Lua support something like thread pools in
> Java?
> 
> In Java you have Runnables (which are just functions that are normally
> executed without taking too much time and usually non-blocking). You can
> submit as many as you wish of such Runnables to a ThreadExecutor. A
> ThreadExecutor is a pool of N Java threads (which can be green threads or
> OS threads depending on the JVM implementation). All submitted Runnables
> are put into a queue belonging to this thread pool. As long as one of the
> threads belonging to such a thread pool  has nothing to do (i.e. does not
> execute a Runnable), it would check if there are more pending Runnables in
> the queue, take the next one from the queue and execute it. Once the queue
> becomes empty, all threads in the thread pool are blockingly waiting (i.e.
> sleeping) until new Runnables arrive.

I don't know java, but this _really_ sounds like coroutines in a scheduler. Where the scheduler decides when to run what coroutine.

Thijs

PS. The message was to me only, replying to list again